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

WordPress Trac noreply at wordpress.org
Tue May 19 13:53:01 UTC 2020


#12821: Merge get_posts() and get_pages()
-------------------------------------------------+-------------------------
 Reporter:  mikeschinkel                         |       Owner:  garyc40
     Type:  enhancement                          |      Status:  assigned
 Priority:  normal                               |   Milestone:
Component:  Posts, Post Types                    |     Version:  3.0
 Severity:  normal                               |  Resolution:
 Keywords:  needs-testing needs-patch needs-     |     Focuses:
  unit-tests 3.8-early                           |
-------------------------------------------------+-------------------------

Comment (by benjibee):

 Attempting to maintain the order of IDs as given and ran into this strange
 decade-old behavior. Using `get_posts()` with `post__in` works as
 expected, I think it's time for this fix, no?

 {{{#!php
 <?php
 $args = array(
     // 'post__in' => array(1, 2 ,3),   // doesn't work at all, ok…
     'include' => array(1, 2 ,3),       // let's try it with this aliased
 parameter
     'orderby' => 'post__in'            // ignored
 );
 $pages = get_pages($args);             // posts sorted by default
 `orderby` value of 'DESC'
 }}}

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/12821#comment:50>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list