[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 21:22:56 UTC 2020
#49118: REST API: minor performance improvement for /wp/v2/users?who=authors
------------------------------+-----------------------------
Reporter: pbiron | Owner: SergeyBiryukov
Type: enhancement | Status: reviewing
Priority: normal | Milestone: 5.4
Component: Users | Version: 4.9.6
Severity: normal | Resolution:
Keywords: has-patch commit | Focuses: rest-api
------------------------------+-----------------------------
Description changed by SergeyBiryukov:
Old description:
> Related: #42202
>
> Changeset [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.
New description:
Related: #42202
Changeset [43001]/[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#comment:5>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list