Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4341456
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T11:29:15+00:00 2026-05-21T11:29:15+00:00

I am trying to do the following with wordpress : If is NOT page

  • 0

I am trying to do the following with wordpress:

“If is NOT page 92, OR page parent is NOT 92.”

Here is what I have:

<?php if (!is_page(92) || $post->post_parent !== 92) { echo $foo; } ?>

If I use one or the other as condition, it works; When I add the second condition, it breaks.

Any help would be well appreciated.

Cheers!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-21T11:29:16+00:00Added an answer on May 21, 2026 at 11:29 am

    Your problem is probably in using || instead of &&.

    You want it to echo if you are not on page 92 AND you are not in a subpage of page 92.

    Let’s say you’re on page 92, then your current code does this:

    if (false || true)

    because 92 is not a parent of page 92. Thus, since one condition is true, it triggers.

    If you’re on a subpage of 92, then it’s the opposite:

    if (true || false)

    If you’re on a page that isn’t 92 or a subpage of 92, then you get:

    if (true || true)

    So, it will always trigger, regardless of what page your on, because || requires only a single true statement for the entire condition to be true.

    Hence, change your code to

    <?php if (!is_page(92) && $post->post_parent !== 92) { echo $foo; } ?>

    Which gives a logical run down like:

    Page 92:

    if(false && true) //false, won't trigger

    Subpage of 92:

    if(true && false) //false, won't trigger

    Some unrelated page:

    if(true && true) //true, will trigger

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following site structure Parent Site -> blog (wordpress) -> get-recent-posts.php ->
Trying to use JQuery Easing plugin in my wordpress but its giving me following
I am trying to automatically install a WordPress distribution in PHP with the following
I have the following code. I am trying to prevent my page from resubmitting
Hey, I am trying to use mod_rewrite to make http://example.com/style/universal.css show the page http://example.com/style.php?n=universal
I am trying to use simplemodal to have modal popups with text in wordpress
following the tutorial at http://josephscott.org/archives/2010/03/database-powered-css-in-wordpress-themes/ i am trying to use wordpress' parse_request function to
I'm trying to implement the following guide to my custom wordpress theme http://tomsbigbox.com/wordpress-load-more-posts-on-page-scroll/ Unfortunately
All, I'm trying to use the do_shortcode function. I have the following jQuery to
I have a WordPress install and I'm trying to use jQuery to create a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.