[wp-trac] [WordPress Trac] #12821: Merge get_posts() and get_pages()

WordPress Trac wp-trac at lists.automattic.com
Thu May 19 16:22:03 UTC 2011


#12821: Merge get_posts() and get_pages()
-------------------------------------+-----------------------------
 Reporter:  mikeschinkel             |       Owner:  garyc40
     Type:  enhancement              |      Status:  assigned
 Priority:  normal                   |   Milestone:  Future Release
Component:  Post Types               |     Version:  3.0
 Severity:  normal                   |  Resolution:
 Keywords:  has-patch needs-testing  |
-------------------------------------+-----------------------------

Comment (by wlindley):

 On line 343 you set the 'order_by' attribute (with underline) but note
 that the routine actually uses 'orderby' (no underline) (see line 1334).

 Also, the 'sort_order' attributes to get_pages() differ from the 'orderby'
 attributes of get_posts() -- the original get_pages() needs, for example,
 ('sort_order' => 'post_date') while the equivalent in get_posts() would be
 ('orderby' => 'date')... but only for certain columns (date, modified,
 author, name, title; but not menu_order, ID, etc.) The exact logic is in
 this code, file wp-includes/query.php in get_posts():

 {{{
          switch ( $orderby ) {
                  case 'menu_order':
                          break;
                  case 'ID':
                          $orderby = "$wpdb->posts.ID";
                          break;
 [...other special cases...]
                  default:
                          $orderby = "$wpdb->posts.post_" . $orderby;
          }
 }}}

 That case-specific test for "ID" should probably change, too, surely 'id'
 should work as well?

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/12821#comment:35>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list