[wp-trac] [WordPress Trac] #44169: New filter to short circuit WP_User_Query results
WordPress Trac
noreply at wordpress.org
Sat Dec 29 16:05:54 UTC 2018
#44169: New filter to short circuit WP_User_Query results
-------------------------------------------------+-------------------------
Reporter: tlovett1 | Owner:
| adamsilverstein
Type: enhancement | Status: closed
Priority: normal | Milestone: 5.0.3
Component: Users | Version:
Severity: normal | Resolution: fixed
Keywords: has-patch has-unit-tests needs-dev- | Focuses:
note |
-------------------------------------------------+-------------------------
Changes (by adamsilverstein):
* status: assigned => closed
* resolution: => fixed
Comment:
In [changeset:"44373" 44373]:
{{{
#!CommitTicketReference repository="" revision="44373"
Users: Add a `users_pre_query` filter to short circuit WP_User_Query
results.
Add a new filter `users_pre_query` - filters the users array before the
query takes place. Return a non-null value to bypass WordPress's default
user queries. Similar to the `posts_pre_query` filter for WP_Query added
in #36687. This filter lets you short circuit the WP_User_Query MySQL
query to return your own results.
Developers should note that filtering functions that require pagination
information are encouraged to set the `total_users` property of the
WP_User_Query object, passed to the filter by reference. If WP_User_Query
does not perform a database query, it will not have enough information to
generate these values itself.
Props tlovett1, birgire, boonebgorges, spacedmonkey.
Fixes #44169.
}}}
--
Ticket URL: <https://core.trac.wordpress.org/ticket/44169#comment:28>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list