[wp-trac] [WordPress Trac] #14477: get_pages with child_of only works with uninterrupted hierarchies
WordPress Trac
wp-trac at lists.automattic.com
Fri Jul 30 19:00:50 UTC 2010
#14477: get_pages with child_of only works with uninterrupted hierarchies
--------------------------+-------------------------------------------------
Reporter: vividvisions | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Query | Version: 3.0
Severity: normal | Keywords: cms,get_pages,get_page_children
--------------------------+-------------------------------------------------
I have a page X with several children and grandchildren. Some of the
grandchildren have a certain meta key and value. I now want to fetch all
pages under page X that have this meta key. After reading the
documentation of ''get_pages'', I expected this to work with a single call
of ''get_pages''.
But if I use get_pages like this:
{{{
get_pages('child_of=X&meta_key=A&meta_value=B');
}}}
it returns no pages at all (hierarchical=0 has no effect). It seems that's
because ''child_of'' triggers a call of ''get_page_children'' which only
returns uninterrupted hierarchies. Since the query returns only some
grandchildren and no direct descendants, the function fails. IMHO, that's
a bug.
--
Ticket URL: <http://core.trac.wordpress.org/ticket/14477>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list