[wp-trac] [WordPress Trac] #43391: WP_User_Query bug

WordPress Trac noreply at wordpress.org
Fri Feb 23 09:47:49 UTC 2018


#43391: WP_User_Query bug
--------------------------+-----------------------------
 Reporter:  zkingdesign   |      Owner:
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  Query         |    Version:  4.9.4
 Severity:  normal        |   Keywords:
  Focuses:  template      |
--------------------------+-----------------------------
 I've got an issue when doing a query with WP_User_Query and trying to list
 from a specific role AND using 'orderby' => 'post_count'. The query simply
 fails to list the correct results.

 Here are the query arguments:
 {{{#!php
 <?php
 $args = array(
         'fields' => array( 'ID', 'user_login', 'display_name' ),
         'role' => 'expert',
         'number'         => $numPosts,
         'offset' => $page > 1 ?  $numPosts : 0,
         'order' => 'DESC',
         'orderby' => 'post_count'
         );
 }}}

 If I remove the 'role' argument from the query it works, but with the
 'role' included it doesn't.

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


More information about the wp-trac mailing list