[wp-trac] [WordPress Trac] #13352: get_children() displays drafts by default

WordPress Trac wp-trac at lists.automattic.com
Tue May 11 17:38:50 UTC 2010


#13352: get_children() displays drafts by default
--------------------------+-------------------------------------------------
 Reporter:  layotte       |       Owner:                        
     Type:  defect (bug)  |      Status:  new                   
 Priority:  normal        |   Milestone:  Unassigned            
Component:  General       |     Version:                        
 Severity:  normal        |    Keywords:  has-patch get_children
--------------------------+-------------------------------------------------
 Was working with get_children and noticed that it was displaying some
 draft pages. According to the current documentation
 (http://codex.wordpress.org/Function_Reference/get_children) the default
 is "any" for post status:

 $args['post_status']
     (string) Any value from the post_status column of the wp_posts table,
 such as publish, draft, or inherit; or the keyword any. Default: any

 I believe it should act like get_posts --- the default should be "publish"
 for posts and "inherit" for attachments.

 Attached is my diff with the fix...

 basically I removed the $defaults setting of 'post_status' => 'any'... and
 I let get_posts handle the logic.

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


More information about the wp-trac mailing list