Title: Multiple conditional not working
Last modified: August 30, 2016

---

# Multiple conditional not working

 *  [sasori390](https://wordpress.org/support/users/sasori390/)
 * (@sasori390)
 * [11 years ago](https://wordpress.org/support/topic/multiple-conditional-not-working/)
 * I want all of my posts and pages not to be indexed for search engines except 
   the front page, page ID 157 & 161, and post ID 334.
    I have come up with the 
   following code but doesn’t seem to be working.
 *     ```
       <?php if( ! is_front_page( ) || ! is_page( 157,161 ) || ! is_single( '334' ) ) {
       	echo'<meta name="robots" content="noindex, nofollow" /> ';
       } ?>
       ```
   
 * The exclusion does not work and it prints the meta tag for all the pages and 
   posts.
    Can someone tell me what’s wrong?

Viewing 2 replies - 1 through 2 (of 2 total)

 *  Moderator [keesiemeijer](https://wordpress.org/support/users/keesiemeijer/)
 * (@keesiemeijer)
 * [11 years ago](https://wordpress.org/support/topic/multiple-conditional-not-working/#post-6220564)
 * Hi sasori390
 * Try it with:
 *     ```
       <?php if( ! ( is_front_page() || is_page( 157,161 ) || is_single( '334' ) ) ) {
       echo'<meta name="robots" content="noindex, nofollow" /> ';
       } ?>
       ```
   
 *  Thread Starter [sasori390](https://wordpress.org/support/users/sasori390/)
 * (@sasori390)
 * [11 years ago](https://wordpress.org/support/topic/multiple-conditional-not-working/#post-6220568)
 * Hi keesiemeijer,
 * It worked with a small tweak.
    For some reasons “is_page( 157,161 )” only works
   for 157, not 161. So I changed to this and it worked.
 *     ```
       <?php if( ! ( is_front_page() || is_page( '157' ) || is_page( '161' ) || is_single( '334' ) ) ) {
       echo'<meta name="robots" content="noindex, nofollow" /> ';
       } ?>
       ```
   
 * Hope this is ok.
    Thanks a million!

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Multiple conditional not working’ is closed to new replies.

## Tags

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

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 2 replies
 * 2 participants
 * Last reply from: [sasori390](https://wordpress.org/support/users/sasori390/)
 * Last activity: [11 years ago](https://wordpress.org/support/topic/multiple-conditional-not-working/#post-6220568)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
