[wp-testers] get_pages() not returning ancestors

Nathan Rice ncrice at gmail.com
Mon Nov 23 15:20:15 UTC 2009


Would anyone have an idea as to why get_pages() wouldn't return ancestors?

$pages = get_pages();
foreach((array)$pages as $page) {
print_r($page);
}

I'm using something similar to this code in a function in functions.php,
which is called in a Widget Form I'm building. For some reason
$page->ancestors isn't returned for pages that I *know* have parents. It's
not like it's empty or anything ... the object key doesn't even exist,
although all the others return just fine (title, excerpt, etc.)

get_post_ancestors($page) doesn't work either, obviously.

Running 2.9 beta, but I'm having a similar problem in 2.8.6.

------------------
Nathan Rice
WordPress and Web Development
www.nathanrice.net | twitter.com/nathanrice


More information about the wp-testers mailing list