[wp-trac] [WordPress Trac] #14477: get_pages with child_of only works with uninterrupted hierarchies

WordPress Trac noreply at wordpress.org
Thu Aug 8 04:18:20 UTC 2013


#14477: get_pages with child_of only works with uninterrupted hierarchies
--------------------------+------------------
 Reporter:  vividvisions  |       Owner:
     Type:  enhancement   |      Status:  new
 Priority:  normal        |   Milestone:  3.7
Component:  Query         |     Version:  3.0
 Severity:  normal        |  Resolution:
 Keywords:  has-patch     |
--------------------------+------------------
Changes (by wonderboymusic):

 * keywords:  needs-patch => has-patch
 * milestone:  Future Release => 3.7


Comment:

 Grandchildren can only be accessed if we know the full list of ancestors
 for the page being checked, [attachment:14477.diff 14477.diff] addresses
 this. The list of pages is mapped earlier to `get_post` to turn them into
 `WP_Post` instances (before `get_page_children()` is called). With a
 proper `WP_Post` instance, we can check `$page->post_parent == $page_id ||
 in_array( $page_id, $page->ancestors )`

 All of these calls are highly-cacheable, but I don't know what everyone's
 feelings are on the performance of `get_post_ancestors()`

--
Ticket URL: <http://core.trac.wordpress.org/ticket/14477#comment:2>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list