[wp-trac] [WordPress Trac] #8527: default get_children behavior broken

WordPress Trac wp-trac at lists.automattic.com
Mon Dec 8 12:31:38 GMT 2008


#8527: default get_children behavior broken
----------------------+-----------------------------------------------------
 Reporter:  filosofo  |       Owner:  anonymous                         
     Type:  defect    |      Status:  new                               
 Priority:  normal    |   Milestone:  2.7                               
Component:  General   |     Version:  2.7                               
 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.

-- 
Ticket URL: <http://trac.wordpress.org/ticket/8527>
WordPress Trac <http://trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list