[wp-trac] [WordPress Trac] #23498: wp_list_authors ignores 'exclude_admin' arg when admin account has a display_name other then 'admin'
WordPress Trac
noreply at wordpress.org
Wed Aug 14 16:00:13 UTC 2019
#23498: wp_list_authors ignores 'exclude_admin' arg when admin account has a
display_name other then 'admin'
------------------------------+-----------------------------
Reporter: raphaabreu | Owner: SergeyBiryukov
Type: defect (bug) | Status: reviewing
Priority: normal | Milestone: 5.3
Component: Users | Version: 3.1
Severity: normal | Resolution:
Keywords: has-patch commit | Focuses:
------------------------------+-----------------------------
Changes (by SergeyBiryukov):
* keywords: has-patch => has-patch commit
Comment:
Found a related issue while looking into this.
`$query_args['fields'] = 'ids'` added in [17100] works here, but only
because `$wpdb->users.ID` is the [source:tags/5.2.2/src/wp-includes/class-
wp-user-query.php?marks=247#L234 default fallback] in
`WP_User_Query::prepare_query()`.
`$query_args['fields'] = 'ID'` should be used instead.
[attachment:"23498.5.diff"] fixes that, uses the same approach for the
`get_users()` call in the `exclude_admin` branch, and updates
documentation.
The proposed unit test doesn't seem to be any different from
`test_wp_list_authors_default()`. We already have a test for
`test_wp_list_authors_exclude_admin()`, that seems enough here, but maybe
could be expanded for multiple administrators.
Given that `exclude_admin` is true by default, I'm not 100% sure excluding
all administrators would be the expected behavior for `wp_list_authors()`,
but I can see it both ways. Marking for commit, unless there are any
objections.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/23498#comment:15>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list