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
- How to display Yoast SEO meta description in archive template for each post instead of the_excerpt()? [closed]
- 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
- Endless loop with wp_insert_post and wp_update_post
- How do I prevent one of two multiple loops from repeating on a second page?
- Hook into the loop via a plugin, and output something after every X post?
- Two custom loops, pagination, offset
- Access to Media Library
- How can I sort get_users() by any value (last_name, user defined fields and more)
- Getting two wp_link_pages output
- Looping through WP_Post Object
- How do you split multiple-column loop on category archive page?
- How to Loop within a Loop (Display Children and then Grandchildren)
- Run The Loop over array of post objects
- Enable infinite scroll on single.php [closed]
- 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
- How to retrieve “sticky” post outside the “loop”?
- Add user data to table when user is created?
- Use wp_update_user to update custom column in wp_users table
- Using get_the_excerpt() Before The Loop
- code suddenly appearing from my tempate second loop
- wp_query inside the_loop
- How to go about combining dropdowns / filter queries?
- Rest API code to get ID of current user not working: get_current_user_id() gives 0
- woocommerce get_price_html not pulling in correct price
- How to Access wp_usermeta Data Immediately After a New User is Created
- How to fix pagination for custom loops?
- 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
- Display post list with different styles
- Loop for sticky posts
- cannot get user_registered date from get_user_meta
- Give each posts in a loop a number in sequence
- custom post on homepage
- get_comments with post_status ‘public’ retrieves NULL result
- Include future posts in tags and in search
- Send admin new order email to logged in user as well
- How would I be able to use a font awesome icon as a user’s avatar?
- Front-End User Profile
- Category ID returns as ‘0’?
- wp_insert_user not creating account correctly when ID is manually set
- Show terms in archive page
- Loops for cat links not looping for wordpress site
- Skip 5 latest post while paging?
- Sort posts according to a numeric value entered with ACF
- How do I update user email from frontend input field?
- wp_get_attachment_url not fetching URL?
- get the value for ALT is we check to see if an actual ALT value is set, if not we use the caption and if no caption is set we use the title
- How can I display Only the first Array/Object?
- How to resolve a reload loop issue in the frontend when logged in to WordPress multi-site backend admin area
- Excerpt isn’t working or am I missing something?
- Can I temporarily disable global $post?
- Shortcode for pulling specific Post Title outside loop when ID is passed in
- Infinite Loop after Genesis Theme Upgrade
- Active class for my flexslider in WordPress
- WordPress loop only displays 5 articles max?
- get_template_part() to render single page Theme
- Can’t see custom field after the Loop [closed]
- Showing related posts (custom post type) outside of the loop
- Paged homepage – requirements?
- Least Number of Loops to Create Custom Homepage?
- The Loop for my theme with static front page is not working
- Showing ads after posts in home page
- Prevent duplicating specific column from database table