Make WordPress Core

Opened 4 months ago

Closed 4 months ago

Last modified 2 months ago

#60071 closed enhancement (duplicate)

wp_list_authors with exclude_admin=true does not exclude administrators

Reported by: juliobox's profile juliobox Owned by:
Milestone: Priority: normal
Severity: normal Version: 1.2
Component: Users Keywords: has-patch 2nd-opinion
Focuses: Cc:

Description

Hi there.

In wp_list_authors() you can find this :

<?php
if ( $parsed_args['exclude_admin'] && 'admin' === $author->display_name ) {

It's an old function (since 1.2) so it should be correctly done doing this:

<?php
if ( $parsed_args['exclude_admin'] && in_array( 'administrator', (array) $author->roles ) ) {

Thanks

Change History (3)

#2 @sabernhardt
4 months ago

  • Keywords 2nd-opinion added
  • Type changed from defect (bug) to enhancement
  • Version changed from trunk to 1.2

Related/duplicate: #9165 (see also [979] and [2444])

While sites ideally would not have a user named 'admin' anymore, excluding only the one user (if found) is the documented use for the $exclude_admin parameter.

The default value is true, so excluding based on role or capability could remove names and/or links unexpectedly for all administrators.

Last edited 4 months ago by sabernhardt (previous) (diff)

#3 @SergeyBiryukov
4 months ago

  • Milestone Awaiting Review deleted
  • Resolution set to duplicate
  • Status changed from new to closed

Hi there, thanks for the ticket!

This was previously raised in #23498, let's continue the discussion there.

Note: See TracTickets for help on using tickets.