[wp-trac] [WordPress Trac] #4711: get_pages and get_posts do not work well with private posts

WordPress Trac wp-trac at lists.automattic.com
Fri Jan 15 16:22:22 UTC 2010

#4711: get_pages and get_posts do not work well with private posts
 Reporter:  Otto42        |       Owner:  anonymous     
     Type:  defect (bug)  |      Status:  new           
 Priority:  normal        |   Milestone:  Future Release
Component:  Template      |     Version:  2.9.1         
 Severity:  normal        |    Keywords:  needs-patch   
Changes (by Otto42):

  * priority:  low => normal
  * version:  2.5 => 2.9.1
  * type:  enhancement => defect (bug)
  * severity:  minor => normal


 Replying to [comment:2 ryan]:
 > get_posts and get_pages should be able to directly retrieve any post
 status, regardless of the current user.  Plugins and the admin need to be
 able to get at anything.  Maybe we need some more args.  post_status__in
 => array('publish', 'private'), check_user_caps => true.  Something like

 Okay, given that, there's still a bug. get_pages cannot retrieve private
 pages, as it has "post_status = 'publish'" hardcoded in its query.

 Seems to me that get_pages is redundant anyway, now. One can simply use
 get_posts with a argument of 'post_type' => 'page' to get pages. The
 get_pages function should probably be reworked to just point to get_posts.

Ticket URL: <http://core.trac.wordpress.org/ticket/4711#comment:12>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software

More information about the wp-trac mailing list