You actually want author__in
, and you can use the array. You shouldn’t implode it:
$query = new WP_Query(
array(
'author__in' => $friendsIdArray
)
);
As far as where in the Loop this goes, I’m not sure I understand. This occurs before creating your a Loop, not in it.
Related Posts:
- What is This esc_html_e() i wordpress php?
- How to store the_title() into a variable to reutrn the value, not just echo it
- Build a content and excerpt grid loop with paging and options for # of posts
- Displaying post per day
- How to add active class to custom menu using while loop and wp_list_pages
- delete an array element when its date expires
- How can I loop into two different DIVS without repeating the DIVs
- Looping through WP_Post Object
- Need to get specific data from array
- Create an array from an array
- Check if term object is in array
- Must Use Plugin Causing Query Error
- How to speed up a wordpress function with multiple loops?
- Custom excerpt function re-factoring
- Get first URL from post content
- How can I add multiple ‘tax_query’ arrays via a loop?
- get a simple array of all of the term names that exist in all taxonomies
- Show css depending on activity type in BuddyPress activity-loop [closed]
- Populate dropdown with Child Pages based on Parent Page chosen
- get author_name from queried post
- foreach loop still echoes array
- Blog posts repeat
- how to refresh div on template part?
- Can’t find infinite loop cause
- Alter required message using comment form api
- meaning of (array)function()
- wp_force_remove_style’ not found
- How to fix this warning:call_user_func_array() expects exactly 2 parameters, 1 given in D:\wamp\www\…….\wp-includes\class-wp-hook.php on line 286
- Custom Pagination is Broken
- Filtering a function’ output for a new continued function
- How to use array in function to get only value I want
- How to get the last category name of a child category?
- Warning: in_array() null given in PHP function
- Show ACF field with link to ultimate member profile/WordPress user profile below the post (single post layout)
- Loop over Array and get the distinct ids
- If Array Values Match Another Array’s Values, Then
- WordPress loop by meta key that is an array? and how loop multiple arrays
- Only show first image in foreach loop
- use loop to return blog details
- How to get current post category details inside “loop”?
- Get all posts as an array ID => Name
- Calling function in loop causes repeat data
- Only load certain artists on this page
- How to make sure relative URL works when site is not on root domain?
- Strip from or something better?
- Custom functions for string data calculations
- How to Add a cutsom slug to my custom author role
- Products listing check if meta checkbox is checked
- in_array not working on dev server but works on localhost
- How to output the taxonomies that are assigned to each custom post?
- update_user_meta as multiple value but with same meta key
- ACF – Get ID of relationship field in flexible content
- cURL needing to loop through all “next_page”
- Show the subcategory name based on current product
- WordPress Ajax filter: Create two loops for different output styles?
- How can I get my pagination loop to display the correct number of total pages?
- Store custom field’s multiple values in one user meta key
- How to sort (orderby) a query done by a template function before the ‘foreach’ loop?
- Fatal error when using array_diff() function inside of wp_update_nav_menu hook?
- How fix error in the WordPress loop?
- Display posts using post ID’s in an array
- My query keeps looping infinitely ! how to stop it?
- Retrieving specific images from Media Library
- Modify category archive page loop on functions.php
- Page returning ID from array, how to return the correct values for post in acf wordpress
- WP_Post is not from correct array
- Create Customization Controls from Array
- Display a post based on its metabox selection
- Pagenav Not appearing on custom Template
- Showing all post from all post type in admin backstage
- Options.php loop won’t show!
- Loop on a wordpress Page instead of content coming from the WP text editor
- Custom WordPress Function – Adding items from Foreach Loop into an array and Updating Field based on array of IDs (ACF + WooCommerce)
- Replace block content with an array
- Error Warning: Declaration of description_walker::start_el after PHP upgrade [duplicate]
- Autoloading in Child Theme
- add_rewrite_rule with bottom priority doesn’t handle the WordPress pages
- Show Custom Taxonomy Title
- PHP code inside shortcodes
- Woocommerce related product text
- Use .php file as page instead of wordpress page & template file?
- Find hours between post_date and post_date_gmt
- Convert the_permalink() function output into string
- get_current_site() is undefined
- blank white page when post/update/change option etc
- writing an unique php function to be used on my website
- Problem in replacing the_content with the_excerpt()
- Output product category link from WP_Query
- Adding onload to body for certain pages
- Change wordpress’ database data using ajax – how to get current user id?
- Best way to use variables in multiple functions?
- Display all categories including sub categories under a list ul
- Cannot fetch posts with certain ‘product_cat’. WP_Query is empty
- Detect what link user clicks and Redirect to a specific page for logged in users only
- Offset with ajax load more posts duplicates
- Efficient way of querying for a “fallback” post?
- Create a hierarchical loop at predefined markup requirements
- syntax error unexpected ‘}’ at 364 line
- Why can’t I include echo inside a variable? [closed]
- Assign new post author IF another user in custom field on post transition