[wp-trac] [WordPress Trac] #34479: New get_orderby() method of class-wp-posts-list-table.class doesn't allow query orderby var to be an array

WordPress Trac noreply at wordpress.org
Thu Oct 29 09:41:16 UTC 2015


#34479: New get_orderby() method of class-wp-posts-list-table.class doesn't allow
query orderby var to be an array
----------------------------+-----------------------------
 Reporter:  szaqal21        |      Owner:
     Type:  defect (bug)    |     Status:  new
 Priority:  normal          |  Milestone:  Awaiting Review
Component:  Administration  |    Version:  trunk
 Severity:  normal          |   Keywords:
  Focuses:  administration  |
----------------------------+-----------------------------
 I've altered the default orderby of pages list table like so:

 {{{
 function my_pre_get_posts($query)
 {
         if(!$query->is_main_query() && $query->query['post_type'] !=
 'page')
                 return;

         $query->set('orderby', array('menu_order' => 'asc', 'title' =>
 'desc'));
 }


 add_action('pre_get_posts', 'my_pre_get_posts');
 }}}

 and I get a PHP Notice caused by strtolower() in get_orderby() method
 which tries to lower an array in my case.

 It worked fine up to 4.3.x.

--
Ticket URL: <https://core.trac.wordpress.org/ticket/34479>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list