#22057 closed enhancement (fixed)
WP_User_Query by default doesn't return the meta values
Reported by: |
|
Owned by: |
|
---|---|---|---|
Milestone: | 3.5 | Priority: | normal |
Severity: | normal | Version: | 3.5 |
Component: | Users | Keywords: | dev-feedback needs-patch |
Focuses: | Cc: |
Description
When calling WP_User_Query it is by default not returning the meta values since it isn't creating a WP_User object. I was wondering if it should be able to return those values.
Currently this from the code that got added in #18428
Attachments (2)
Change History (12)
#2
@
12 years ago
- Cc knut@… added
- Keywords needs-patch added
- Type changed from defect (bug) to enhancement
#4
@
12 years ago
Do we need all_with_meta now that WP_User loads meta on demand? We could always return WP_User objects from WP_User_Query and avoid the unconditional update_meta_cache() call in cache_users(). That leaves deciding whether to slurp * from the users table like 'all' does or slurp the IDs and then pass to cache_users() to query for users not already cached (with update_meta_cache() removed) like all_with_meta does.
#5
follow-up:
↓ 6
@
12 years ago
Perhaps: Make all_with_meta a synonym for all. Always do the split style query for all. Introduce some cache control flags similar to cache_results and update_post_meta_cache used in WP_Query. Always return WP_User objects.
#6
in reply to:
↑ 5
@
12 years ago
Replying to ryan:
Perhaps: Make all_with_meta a synonym for all. Always do the split style query for all. Introduce some cache control flags similar to cache_results and update_post_meta_cache used in WP_Query. Always return WP_User objects.
Works for me.
#7
@
12 years ago
+1 for always returning WP_User objects. Also:
if ( 'all_with_meta' == $q['fields'] ) { $q['fields'] = 'all'; $q['cache_results'] = true; }
#8
@
12 years ago
- Owner set to ryan
- Resolution set to fixed
- Status changed from new to closed
In [22248]:
If you call fields => all_with_meta, you'll get user objects back.