[wp-trac] [WordPress Trac] #57083: wp_list_authors and WP Search Users

WordPress Trac noreply at wordpress.org
Tue Nov 15 21:50:56 UTC 2022


#57083: wp_list_authors and WP Search Users
---------------------------------------+------------------------------
 Reporter:  pabloeduardo               |       Owner:  (none)
     Type:  defect (bug)               |      Status:  new
 Priority:  normal                     |   Milestone:  Awaiting Review
Component:  Query                      |     Version:  6.1
 Severity:  normal                     |  Resolution:
 Keywords:  needs-patch needs-testing  |     Focuses:
---------------------------------------+------------------------------

Comment (by petitphp):

 Hi, welcome to WordPress Trac, and thanks for the ticket !

 > Apparently wp_list_authors is loading a deprecated WordPress class
 called WP Search Users, this class has now been replaced with WP Query
 Users but wp_list_authors keeps using WP Search Users.

 Looking at `wp_list_authors` in the latest version of WordPress (6.1), I
 couldn't see the call to `WP_User_Search` you mentioned. The function uses
 `get_users` to retrieve the list of users, which uses the `WP_User_Query`
 internally.

 Could you give more details where you saw the call to `WP_User_Search` ?

 >However the case wp list authors is only accepting some parameters,
 neither through array or through post accepted more parameter, meaning
 that something like this worked:
 >
 >{{{
 >wp_list_authors('orderby=name&order=DESC');
 >}}}
 >
 >but something like this did not:
 >
 >{{{
 >wp_list_authors('orderby=name&order=ASC');
 >}}}
 >
 >or even
 >
 >{{{
 >wp_list_authors('orderby=name&order=DESC&optioncount=1');
 >}}}
 >
 >My original code wasn’t working because it was stated as follows:
 >
 >{{{
 >$authors = str_replace( ', ', '<br>', wp_list_authors([
 >    'style'         => 'none',
 >    'optioncount'   => 1,
 >    'echo'          => 0
 >]) );
 >echo $authors;
 >}}}

 In my testing, all the examples you gave did work as expected.

 Can you give more information on what didn't work or on the errors you
 encountered ?

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


More information about the wp-trac mailing list