0

I'm trying to exclude one child from the children of a parent. What do I need to change here? thanks

if ( $post->post_parent == '4426' || in_array( '4426', $post->ancestors) && (!is_page('4430')  ) { // Who We Are
    //do something
}
1
  • What's the context here? Are you trying to run the conditional IF you're not on the specific page with the ID 4430? Are we in a loop here?
    – Howdy_McGee
    Commented Oct 23, 2014 at 21:06

1 Answer 1

0

Maybe it's just a matter of parentheses.

if ( ( $post->post_parent == '4426' || in_array( '4426', $post->ancestors) ) && !is_page(4430)  ) { // Who We Are
    //do something
}

I'm assuming is_page accepts an Integer being the page ID and 4430 is not the slug or page title.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.