Your call to get_user_by() has a small hiccup in it. It needs to be login rather than user_login
// Search these Usernames
$usernames = array('user1', 'user2');
// Fetch the User IDs
$prof_ids = array();
foreach ($usernames as $prof_id) {
$user = get_user_by('login', $prof_id);
$prof_ids[] = $user->ID;
}
// WP_User_Query arguments
$args = array(
'include' => $prof_ids,
);
Related Posts:
- Can’t access PHP array inside script localization from javascript
- How to get all multi-select user meta values and add them to an array?
- Display all existing members
- Show newly added posts since last user login time /date
- post__in – Placing content from a foreach loop inside of an array
- Custom search form to display users only
- Problem with displaying HTML content after in_array [closed]
- How do I make a variable available inside partials?
- Enabling users to control custom loop’s query
- Array ids post to function have_post
- Get author Meta for particular user inside the loop
- Output meta into arrays
- Trying to get property of non-object in shortocde
- How can I access specific posts brought back by query_posts?
- How to create a multidimensional array with multiple loops
- Loop through an array inside a class using foreach [closed]
- CPT while loop not working
- using update_user_meta to rank users
- display post tags on single.php inside loop
- Exclude posts based on an array
- Override orderby to create list of users by custom meta_value
- Add 2 values to post__not_in
- Query users and count totals based on meta values
- Exclude Posts Using Meta Query and User Meta
- Query posts and display all dates in repeater field in chronological order
- Show a list of user posts in the user admin page
- Get Sticky User in user loop based on user role
- Can’t print out returned value
- Combine Query and Select Database to create directory loop
- WordPress loop: Display if posts exist
- How can I access ‘key’ and ‘value’ from an array in a for loop?
- How to get files from loop for zip
- Users as team members through a loop in elementor
- How to filter users on admin users page by custom meta field?
- How to place comments_template(); outside the loop?
- Wp_User_Query not sorting by meta key
- How do I prevent one of two multiple loops from repeating on a second page?
- How are both HTTP and HTTPS versions displaying?
- Extend the wp_users table
- How do you split multiple-column loop on category archive page?
- How to Loop within a Loop (Display Children and then Grandchildren)
- How to loop through ALL pages?
- Does get_template_part pull data once in a loop?
- Get titles of all posts with current tags except current post
- Creating a multi-taxonomy query, excluding the newest (read: highest ID) taxonomy term
- Show a different post every 3 days [duplicate]
- Add user data to table when user is created?
- Remove admin menu links for multiple users by email
- Use wp_update_user to update custom column in wp_users table
- Using get_the_excerpt() Before The Loop
- What is the maximum number of posts a WordPress loop can work with?
- wp_query inside the_loop
- How to go about combining dropdowns / filter queries?
- How to Access wp_usermeta Data Immediately After a New User is Created
- WordPress Rewriting the DOM?
- How to display posts by vote count and if no value continue with latest posts with no votes?
- Sort results by groups of numbers and letters
- Using Javascript for Looped Content
- Making a query to the DB using same parameters of loop
- Variable not being passed into WordPress loop
- Exclude duplicated $sticky post from combined loop content
- Getting a custom field in the middle of a loop
- WP Loop. If featured image is a panorama (3:1 ratio) execute some code
- How to Loop with the final result formatted differently?
- Users table missing from Database [closed]
- Tags on page (not post) returns nothing – why? Improved clarified question!
- Add custom user meta data
- Getting page slug
- How to get pagination to work with 2 wordpress loops
- How is WordPress changing the content markup?
- Inserting CPT and static content at every X post, is this possible?
- Exclude specific user_id from args in get_comments
- loop through posts and display inserted media and post title as a link
- Exceprt not displaying
- Add File Attachment Name and URL into Javascript
- How to tell if all posts are only in one category?
- How do I set the Stewart Search Template to return only published posts in the result
- Custom archive page for custom taxonomy and pagination issue
- Updating Post meta (ACF field) from Feed
- User updating their profile wipes my custom fields
- How to separate post titles with a comma in the loop?
- Hook into form handle from admin users table
- get_posts changes main query
- Trying to get property ‘post_content’ of non-object
- WordPress loop : how to exclude some posts with their status?
- How can get all users by current user meta (array)?
- Homepage Loop Somehow Breaks Styling Of Post Grid
- Store extra user values permanently
- Next 10 posts data of currently viewing post in blog page
- Have multiple loops on a page appear after/between page content
- How to fix pagination for custom loops?
- Sort users by custom user meta value
- trying to write a variable into a wp_query, need help!
- Showposts doesn’t show the number of posts indicated
- Using in_category for non standard loops
- Use Loop or direct database query?
- How wp maps urls into files
- Display Featured Image
- AJAX in wordpress theme loop
- Duplicate post problem