Opened 8 years ago
Last modified 14 months ago
#43680 reviewing enhancement
Add new filter to WP_User_Query
| Reported by: | spacedmonkey | Owned by: | SergeyBiryukov |
|---|---|---|---|
| Priority: | normal | Milestone: | Future Release |
| Component: | Users | Version: | 3.1 |
| Severity: | normal | Keywords: | has-patch needs-test-info |
| Cc: | Focuses: |
Description
Add a new filter to filter the value of results returned from the WP_User_Query. This brings the WP_User_Query class inline with other query classes, like WP_Query, which already has posts_results filter. This filter is a powerful one, that will allow for third party code, to hook in and change the results of the query.
Attachments (3)
Change History (12)
#3
@
8 years ago
- Focuses performance removed
- Keywords needs-testing added
- Type defect (bug) → enhancement
Removing the performance focus and converting from bug to enhancement as nothing is technically broken here.
#6
in reply to: ↑ description
@
8 years ago
Replying to spacedmonkey:
Add a new filter to filter the value of results returned from the WP_User_Query. This brings the WP_User_Query class inline with other query classes, like WP_Query, which already has
posts_resultsfilter.
For consistency with the posts_results filter, which accepts an array of WP_Post objects rather than stdClass objects, I guess I would expect users_results to accept an array of WP_User objects.
What do you think of 43680.3.diff? It runs the filter a bit later, after converting the results to WP_User objects when fields is all or all_with_meta, but before retrieving metadata via cache_users().
#9
in reply to: ↑ description
@
14 months ago
- Keywords needs-test-info added; needs-testing removed
Replying to spacedmonkey:
This filter is a powerful one, that will allow for third party code, to hook in and change the results of the query.
@spacedmonkey can an example, Testing Use Case, be provided?
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)
Related: #43679