Not exactly sure what you’re aiming at with your queation, because, why shouldn’t it be legit to get the data you want by looping trough the available users, to be exact in one way or another you kind of have to do it this way, get the users and then get the user meta to display – so I’d say, it’s legit.
Concerning your approach there is to note that get_the_author_meta()
doesn’t take user objects, it expects the user ID, so you either have to make use of the fields
parameter of get_users()
by specifying it to return an array of IDs. Like this:
$admins = get_users('role=administrator&fields=ID');
Or you specify the fields
parameter to return user objects that already include the user meta. Like this:
$admins = get_users('role=administrator&fields=all_with_meta');
If you’re going to use the latter option you have to change your the_author_box()
function accordingly.
Related Posts:
- Add another role to a user when they click a button?
- Shortcode for Listing Users from Meta Value?
- Uses for function: wp_update_user
- Allow a user or role to view drafts and previews, but not other admin privileges?
- Display current user metadata on WordPress page
- Private messaging – Getting and displaying the avatar/url of a message recipient
- Custom Admin Menu Report for Specific User ID
- Create a global variable for use in all templates
- Can i check if user is doing any ajax request?
- Calling a method from functions.php on a click of a button
- Showing user ID on user main page from screen options
- How can I default to all WordPress roles when parameter is not included in shortcode?
- Get all user meta by meta key instead of ID
- How to get a list of all possible values of a specific user meta key?
- How do I display a user’s previous orders as a select box option on a product?
- create shortcode to list users with specific meta key value
- How to check if a meta value has already been assigned to any user?
- function to assign user role based on a field from usermeta
- Get users that likes the post
- How to abort saving data in save_extra_profile_fields function WordPress?
- custom user role wordpress – grant guest access to edit.php without insert/update/delete
- Do not execute If User is login as Administrator or any Specific Role
- Update user profile information from functions.php
- Call to undefined function get_userdata() in plugin
- Read array in php?
- Countdown to date function?
- How to keep the capability of users and disable Gutenberg editor in WordPress?
- If Array Values Match Another Array’s Values, Then
- Get the users that my following users are following
- Query for user roles
- Get users with different roles and call function on each of them (user_meta)
- How can I call a specific file (via php) by referencing the logged-in username?
- Use of antispambot with $curauth->email
- Execute PHP code only with specific user role
- How to Add a cutsom slug to my custom author role
- Execute function only for specific user roles
- Change wordpress’ database data using ajax – how to get current user id?
- How to add and subtract user meta values after post meta update
- Include User ID in iFrame URL
- WP custom posts: filter results to custom taxonomy tag that corresponds to user meta field
- Get current user id in function php
- Hide payment method based on user role AND minimum cart value
- Edit a function to take different actions based on user role
- Store data from JavaScript object to custom table in user account
- Export WordPress User Meta to CSV/Excel
- How to change the value of a variable using input field?
- How Can I Display the Last Modified Date for User Profiles on WordPress?
- Get user by meta data key and velue
- Where do I implement this display of User Meta Data, and how to put it in a table?
- Store custom field’s multiple values in one user meta key
- Get field in readable word
- is_user_logged_in() not working in homepage
- Can’t get_users info by using json_encode
- Matching multi user
- Updating custom user meta
- Allow BBPress participant role to trash topics
- main menu page redirects to user ID
- How to connect database table to each registered wordpress user.
- Let users register weight each day and save it in DB
- Display a list of users with avatar filterable with alphabets
- Cross origin ajax request always returns 0 when calling get_current_user_id();
- Forbid certain users to access a specific page
- A better way to write this php function
- Import users and custom user meta from csv
- How to lock users account until approvation
- How to create a User Role and give permission to only use Web Stories plugin?
- How to create custom user role without plugin?
- How to add custom user role into wordpress
- start_lvl Ignored in Custom walker_nav_menu
- How do I make my function add variables/values to the $post object?
- Calculate percentage of post by category
- Change comments form title on a page by page basis
- Get the title before comma
- “Can’t use function return value in write context” error
- Display 4 chronological posts starting with a random post
- Run a filter when a walker runs
- Display fields as values in array from external SQL DB
- How can I remove a function that has been added to wordpress with add_filter?
- Get value from shortcode to do something
- Can’t find infinite loop cause
- Download PDF after CF7 form submission
- Creating a mobile site by adding a new class to the body tag from functions.php
- Is it possible to create new user from external form using REST API?
- Foreach loop inside an array_merge
- Export Form Data to a CSV then send it as an attachment – contact form 7
- Cant display an image via PHP in wordpress
- Template Loop – add switch case php
- Image rotation issue (horizontal picture uploading as vertical) — Exif issue?
- Edit Account – read and write to MySQL
- Unable to Call More than One Meta Box Output
- Dropdown category field inside repeatable metabox
- Retrieve alt text by referencing the img src
- Allow a particular user to access a particular plugin?
- Delete post meta by serialized meta value
- Create a temporal post
- Use WP user status (logged_in) to manage access to independent application
- How to have Function of a plugin using global vars into a shortcode?
- WordPress causing all code to be displayed on line 1. Receiving multiple errors after cleaning cookies and cache
- Automatically change insurance quantity based on cart total [closed]
- hiddenQuestions.find is not a function