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
- Inside nested wordpress loop (post & post-type) ” in_array()” function can’t retrieve the matching value
- Attachment Metadata inside of Loop
- Loop 1 user randomly
- How can I make this iterative conditional within the Loop work via function?
- Posts Per Page is Not Returning Correct Number
- List users of specific role instead of removing them with specific role
- Creating multiple profiles under one user to assign to particular posts
- Infinite Loop after Genesis Theme Upgrade
- UserMeta Changes Meta Value for Post ID
- Modify widget to output posts in custom order
- Alternative layout the loop
- Why loop renders only last metabox from array? [closed]
- Store extra user values permanently
- Cant pull in featured Image
- How to execute custom loop before loop content?
- Page gets displayed in post field
- Repeat code, change variable?
- the_content() keeps repeating itself
- Custom Looping of WordPress Posts
- How do I change the user via SQL?
- Foreach loop inside foreach loop?
- Show different Google Map markers for different post_meta values
- Add method for tracking who referred new users
- how to place Post and page content side by side
- Show posts by tags excluding current post
- Add specific class to featured posts
- Adding options to loop
- Make custom WordPress comments list
- numberposts not responding to wp_reset_postdata()
- Echo Most Recent Sticky Post in Loop?
- Need help getting a certain value out of a multi dimensional array
- Template included with plugin doesn’t return all posts for custom taxonomy
- Ajax loop and history.js for SEO
- to get a little more content after ‘read more’ inside loop
- WP_Post is not from correct array
- Extend WP_User_Query or WP_User to return all custom fields?
- Show all child categories associated to post ID within loop
- Username has been exposed
- Remove posts_orderby filter then add it back in
- Create Customization Controls from Array
- the_title() Returns the page title instead of the post
- Strange problem with wp_get_attachment_image_src database (db) query count
- How to include posts from one category, into a separate category of posts?
- how do i make this loop work
- Active class for my flexslider in WordPress
- Foundation modal in wordpress php loop
- Link Button url count php and wordpress
- User list order by user meta
- Sorting posts to make those with post thumbnail show up first
- Best way to check if a post with specific meta exists
- ACF field not appearing correctly in loop
- Iterate through ID’s in loop
- pre_get_posts main_query not displaying after applying tax_query filters
- Issue with WP_Query (need a array of selected ID’s)
- Archive sorted by month – separate
- WP update_post_meta link loop
- WordPress loop only displays 5 articles max?
- How to query authors by custom taxonomy?
- Limit article to 100 characters. Can’t use the_excerpt…
- Next 10 posts data of currently viewing post in blog page
- Structure and Display Content from Multiple Pages on Single Page
- Creating a archive for taxonomy terms, not the term results
- Making a specific page wordpress compatable that is not index
- Return only content in excerpt field in loop
- Ajax category pagination problem
- How do I aproach this?(for sale, for lease, sold->move something from a category to another)
- Unable to login + Redirect loop on mobile