I’m not sure what the cause was for your plugin to suddenly stop working on my site, but I wanted to relay the fix that worked for me. I replaced your conditional with
if ( is_page( $page ) || ( in_array( $page, get_ancestors($post->ID, $post->post_type) ) ) )
Some other plugin must be the cause, but I reviewed all my plugin updates of late and scoured the code for hours trying to see what might mess with the ancestors array. Even calling
get_post_ancestors($post)did not work.
- The topic ‘[Plugin: Is Page or Ancestor] $post->ancestors was always blank, so always returned false’ is closed to new replies.