Title: is_single array not working
Last modified: August 21, 2016

---

# is_single array not working

 *  [specimen65](https://wordpress.org/support/users/specimen65/)
 * (@specimen65)
 * [12 years, 8 months ago](https://wordpress.org/support/topic/is_single-array-not-working/)
 * I am trying to conditionally hide ads on certain posts. I’ve used both post ID’s
   and post slugs/titles and am no further ahead.
 * The problem is that the following codes, added into the template file (single.
   php) only seem to either only acknowledge a single post ID or the first ID in
   a string. The array (which I am betting is syntactically correct) doesn’t work
   at all.
 * this works – hides code on post ID #30:
 *     ```
       <code><?php if( !is_single('30') ) : ?>
       ~ ad code goes here ~
       <?php endif; ?></code>
       ```
   
 * this partially works – hides code only post ID #30 but not on others:
 *     ```
       <?php if( !is_single(30,62,50,61,27,94,102,86,64,29,49 ))  : ?>
       ~ ad code goes here ~
       <?php endif; ?>
       ```
   
 * this doesn’t work at all – returns blank page:
 *     ```
       <?php if( !is_single( array( 30,62,50,61,27,94,102,86,64,29,49 ) )  : ?>
       ~  ad code goes here ~
       <?php endif; ?>
       ```
   

The topic ‘is_single array not working’ is closed to new replies.

## Tags

 * [array](https://wordpress.org/support/topic-tag/array/)
 * [is_single](https://wordpress.org/support/topic-tag/is_single/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 0 replies
 * 1 participant
 * Last reply from: [specimen65](https://wordpress.org/support/users/specimen65/)
 * Last activity: [12 years, 8 months ago](https://wordpress.org/support/topic/is_single-array-not-working/)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
