Took me some time to find this topic and the function listed above.. Made som changes to track back one level.. don’t know if it’s the best solution but i works for me..
….foreach ($pages as $page)
{
if ($page->ID == $page_obj->ID && $page->post_parent == $id)
{
return true;
}
// Track back..
if ($page->ID == $page_obj->ID)
{
$check1 = $page->post_parent; // get current post_parent
foreach ($pages as $page)
{
if ( $page->ID == $check1 && $page->post_parent == $id)
return true;
}
}
}…..
/ Andreas