Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Disable Adsense Ads From 404 Pages In Wordpress
Step 1. Remove adsbygoogle.js from all Ad units
Step 2. Paste below snippet in the Theme functions.php or use Code Snippets plugin
function conditional_adsense_display() {
if ( ! is_404( ) ) echo '<script async src="//"></script>';}
add_action('wp_head', 'conditional_adsense_display');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.