• Hello. First of all, I have no idea how long this has not been working properly. It was just brought to my attention by my client, though, and I know it was working at one time… Perhaps over a year ago.

    I’m assuming something changed in the processing of the array logic statements, but I can’t figure it out.

    THESE WORK ON PARENT AND CHILDREN OF PAGE #32702:
    is_tree('32702') and !is_tree('32702')

    THESE WORK ON THE PARENT but not the children of the page IDs given:
    !is_tree( array(32702, 36412, 516)) and is_tree( array(32702, 36412, 516))

    If you need, here’s the function for ‘is_tree’:

    function is_tree($pid) {      // $pid = The ID of the page we're looking for pages underneath
    	global $post;         // load details about this page
    	if(is_page()&&($post->post_parent==$pid||is_page($pid))) 
                   return true;   // we're at the page or at a sub page
    	else 
                   return false;  // we're elsewhere
    };

    Any help from the author or community would be greatly appreciated!

    • This topic was modified 6 years, 6 months ago by cozbaldwin.
  • The topic ‘Array using is_tree custom condition is only working on parents’ is closed to new replies.