[wp-trac] [WordPress Trac] #49118: REST API: minor performance improvement for /wp/v2/users?who=authors
WordPress Trac
noreply at wordpress.org
Thu Jan 2 15:39:37 UTC 2020
#49118: REST API: minor performance improvement for /wp/v2/users?who=authors
-------------------------+-----------------------------
Reporter: pbiron | Owner: (none)
Type: enhancement | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Users | Version:
Severity: normal | Keywords:
Focuses: rest-api |
-------------------------+-----------------------------
Related: #42202
Changeset [https://core.trac.wordpress.org/changeset/43137 43137] added a
`who=authors` parameter to the `list users` endpoint.
When that parameter is present,
`WP_REST_Users_Controller::get_items_permissions_check()` checks that the
current user has the capability to `edit_posts` for at least 1 post type
that has `show_in_rest = true` and supports author. That check loops
through **all** post types with `show_in_rest = true`.
A minor performance improvement could be had by breaking out of that loop
as soon one post type is found that meets the requirements.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/49118>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list