Make WordPress Core

Opened 7 years ago

Last modified 10 months ago

#23498 reviewing defect (bug)

wp_list_authors ignores 'exclude_admin' arg when admin account has a display_name other then 'admin' — at Version 2

Reported by: raphaabreu Owned by:
Milestone: Future Release Priority: normal
Severity: normal Version: 3.1
Component: Users Keywords: has-patch 2nd-opinion
Focuses: Cc:

Description (last modified by SergeyBiryukov)

Line 293 of author-template.php should be changed from:

if ( $exclude_admin && 'admin' == $author->display_name )


if ( $exclude_admin && 'admin' == $author->user_login )


Change History (2)

#1 @knutsp
7 years ago

  • Cc knut@… added

'admin' should be avoided as user_login anyway. On a single site there is usually a site owner, identified by the user who has the same email as the one who installed it and may be still be the receiver of admin emails for the site.

if ( $exclude_admin && get_option('admin_email') == $author->user_email )

This will exclude one, or sometimes no users. Or just deprecate the whole $exclude_admin thing in favor of something more modern in terms of today's WordPress roles and capabilities.

#2 @SergeyBiryukov
7 years ago

  • Description modified (diff)
  • Keywords has-patch removed
  • Version changed from 3.5.1 to 3.1

Related: #9165, #9902

Introduced in [15620], previously user_login field was used for comparison.

The parameter itself was added in [2632]. We should probably deprecate it in favor of exclude (#9902).

Still, fixing it makes sense to me. The description refers to "the 'admin' user that is installed by default":

Codex specifically refers to the login: "Exclude the 'admin' (login is admin) account from the list":

The default username, however, can be manually picked now (#10396).

I guess we have the following options to fix this:

  • 'admin' == $author->user_login.
  • 1 == $author->ID (from #9165).
  • get_option('admin_email') == $author->user_email (from comment:1).
Last edited 7 years ago by SergeyBiryukov (previous) (diff)
Note: See TracTickets for help on using tickets.