#60071 closed enhancement (duplicate)
wp_list_authors with exclude_admin=true does not exclude administrators
Reported by: | 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)
This ticket was mentioned in PR #5765 on WordPress/wordpress-develop by @sebastienserre.
10 months ago
#1
- Keywords has-patch added
#2
@
10 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.
Note: See
TracTickets for help on using
tickets.
https://core.trac.wordpress.org/ticket/60071