WP_User objects have some magic methods which do allow you to access any custom field:
foreach ( $agents as $agent ) {
var_dump( $agent->bio );
var_dump( $agent->get( 'bio' ) );
}
The two are equivalent.
More info: http://scribu.net/wordpress/the-magic-of-wp_user.html
Related Posts:
- Reduce number of SQL queries inside WP_Query loop to fetch author data
- How to add custom query filters in WP_User_Query
- Searching user meta using WP_User_Query
- Query wp_usermeta alongside wp_users
- WP User Query get all authors with last name starting with specific letter
- How to properly use AND / OR in custom search
- Random users always showing same 8 users
- How to do WP_User_Query for Nested Array value Inside Nested Array field
- How to query 5 users in random who have published more than 10 posts
- WP_User_Query not searching numbers?
- Query Users by post count, last 30 days and display each users post count according to post type
- Get all user with both meta_value
- Wp_User_Query not sorting by meta key
- WP_User_Query with combined meta query – not working?
- SQL query equivalent to WP User Query
- Filter user list that meta_value is empty
- SQL User Query by Multiple Roles using PHP
- WP User Query fails when searching meta queries and search columns
- WP_User_Query unable to retreive all user at once
- Sort users by “birthday” using WP_User_Query
- Minimize database queries to user tables?
- Query users by capability – uninstall/deactivate callback
- How to display specific posts with WP_Query?
- Hide Administrators From User List except current user (administrator)
- WP_User_Query pulling ACF to loop
- WordPress search posts by author name with autocomplete
- pagination with numbers for WP_User_Query
- How to display user order by role
- Import wp users via one click demo option
- Meta_query on same meta key, with diffrenct values
- Dynamic User Id
- Get users that likes the post
- Passing args to WP_User_Query am I using meta correctly?
- Randomize Users
- Prevent author bio page from showing in search results
- WP User Query with Custom Fields and Search Results
- Get multiple users with meta value in one query and populate WP_User class
- Display if author page is author page of current user
- array of meta values using WP_User_Query
- Get user first name from custom endpoint
- Display the line breaks in user bio without using html
- WP_User_Query and user posts
- construct complex queries with WP User Query
- Storing an array of objects related to each user
- Create one-use post dynamically, add to main query, do not insert post (user profile view)
- query post by author gender
- WP_User_Query orderby meta_val_num
- Query to get last posts from authors of blog
- WP_User_Query not searching
- Replace wp_query with wp_user_query
- Query pages created by deleted users
- Counting instances of words in the results of a post query
- Query posts by post type, author and post meta
- SQL to join u3g_users & u3g_meta_value with repeating data
- Getting user data via ajax
- WP_User_Query Orderby Not Working
- Unusual high query of user meta data
- Set “editor” role to existing user
- How to query users by post count no less than 10
- using custom meta user data to run queries in WordPress
- Merge wp-query and get_users
- Get all wp_users sort by metakey
- Logging search queries for logged-in users
- Best way to query posts and order by relevancy to query
- List users by Year of Birth using a foreach loop to dynamically populate years and data
- Show subscriber id in loop
- Extend WP_User_Query or WP_User to return all custom fields?
- WP_Query within save_post doesn’t include the item that triggered the action?
- Search Functionality broken by the wp 4.2 update
- Sort users by custom user meta value
- How ‘secure’ are loops?
- Get users query makes the site loading time too big?
- Extend user search in the Wp backend area on the users.php page to allow for searching by email domain and role from the “users search” input box
- WordPress WP_User_Query ignores the `meta_query` when called from an Ajax function
- Check if user is admin by user ID
- Execute a large WP_Query with many “AND” Meta_Queries?
- JSON: schedule creation of json file
- How to detect if a function has been fired on any page so scripts/styles can be loaded conditionally
- WP_Query Ignoring `post_type` parameter
- How to display 7 most recent days of posts?
- WP_Query Variable inside Array
- Create A Loop With A Variable Number of Posts For Each Bootstrap Row?
- Count author posts in certain category
- Taxonomy Query Relation field not behaving correctly?
- How to get all post except particular category without breaking the paging
- How do I rewrite this loop as a new WP_Query style-loop?
- Pagination only won’t work in author template
- WP_Query meta value order is not working
- How to get specific string in explode array?
- SQL query injection with fifu image
- 3 posts from each existing category on one page
- How to show specify category template for both parent and child category
- WordPress search page pagination displaying but not functional
- query all posts published by certain user id
- Query custom meta value – post view and date meta
- Orderby Date and Category
- problem in query_vars parameters
- Limit Tags display and ad Drop Down Menu
- Add banner after the third post [closed]
- Refresh wp_query with no changes