function is_ancestor( $post_id ) { global $wp_query; $ancestors = $wp_query->post->ancestors; if ( in_array( $post_id, $ancestors ) ) { $return = true; } else { $return = false; } return $return; }