Title: Google Adsense code ignores if() statement?
Last modified: September 1, 2016

---

# Google Adsense code ignores if() statement?

 *  [pils87](https://wordpress.org/support/users/pils87/)
 * (@pils87)
 * [9 years, 11 months ago](https://wordpress.org/support/topic/google-adsense-code-ignores-if-statement/)
 * Ola!
 * I got this adsense code in my single.php file, i want this to show on all of 
   them except my homepage.
 *     ```
       <?php if ( !is_home() ) { ?>
       <script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
   
       <ins class="adsbygoogle"
            style="display:inline-block;width:728px;height:90px"
            data-ad-client="ca-pub-8929775238275343"
            data-ad-slot="4535981711"></ins>
       <script>
       (adsbygoogle = window.adsbygoogle || []).push({});
       </script>
       <?php } ?>
       ```
   
 * With this code it still shows up on my homepage. Weird thing is that when i put
   some random text in the if() statement it works like it should.
 * What am i missing?
 * Gr. Pils

Viewing 1 replies (of 1 total)

 *  Moderator [Steven Stern (sterndata)](https://wordpress.org/support/users/sterndata/)
 * (@sterndata)
 * Volunteer Forum Moderator
 * [9 years, 11 months ago](https://wordpress.org/support/topic/google-adsense-code-ignores-if-statement/#post-7576043)
 * is_home vs. is_front_page
 * [http://wordpress.stackexchange.com/questions/30385/when-to-use-is-home-vs-is-front-page](http://wordpress.stackexchange.com/questions/30385/when-to-use-is-home-vs-is-front-page)
 * I usually take the lazy way out and use something like
 * `if ( !is_home() && !is_front_page() ) { stuff } else { other stuff }`

Viewing 1 replies (of 1 total)

The topic ‘Google Adsense code ignores if() statement?’ is closed to new replies.

## Tags

 * [if](https://wordpress.org/support/topic-tag/if/)
 * [single](https://wordpress.org/support/topic-tag/single/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 1 reply
 * 2 participants
 * Last reply from: [Steven Stern (sterndata)](https://wordpress.org/support/users/sterndata/)
 * Last activity: [9 years, 11 months ago](https://wordpress.org/support/topic/google-adsense-code-ignores-if-statement/#post-7576043)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
