Make WordPress Core

Opened 2 years ago

Last modified 23 months ago

#57083 new defect (bug)

wp_list_authors and WP Search Users

Reported by: pabloeduardo's profile pabloeduardo Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version: 6.1
Component: Query Keywords: needs-testing reporter-feedback
Focuses: Cc:

Description (last modified by sabernhardt)

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.

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;

Change History (3)

#1 @sabernhardt
2 years ago

  • Description modified (diff)

#2 @petitphp
2 years ago

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 ?

#3 @SergeyBiryukov
23 months ago

  • Keywords reporter-feedback added; needs-patch removed
Note: See TracTickets for help on using tickets.