On Mon, Nov 23, 2009 at 9:20 AM, Nathan Rice <[email protected]> wrote: > 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.)
Do you mean "post_parent"? Because get_pages() doesn't call _get_post_ancestors(), unlike get_post(), so the "ancestors" property of the page object won't be set. However, you should see "post_parent" set if that page has a parent object. _______________________________________________ wp-testers mailing list [email protected] http://lists.automattic.com/mailman/listinfo/wp-testers
