default get_children behavior broken
|Reported by:||filosofo||Owned by:||anonymous|
|Severity:||normal||Keywords:||get_children post_status post_type|
It used to be (at least to 2.5.1) that something like
get_children(array('post_parent' => 123));
would return the children of 123---all of them.
Now, however, the posts query for the above ends up with the following in the where clause, which is not likely to return any children:
AND wp_posts.post_type = '' AND (wp_posts.post_status = 'publish')
That's because post_type and post_status are not specified by get_children(), so they're set to those defaults. Since children probably have a post_type of "attachment" and status of "inherit", we're not going to be returning any children.
My patch sets the defaults of get_children() to ignore post_status and post_type if not set.
This will not affect any core behavior, because all calls to get_children() in core specify post_status and type.