First of all, I suggest don’t use query_posts
.
(No one is really a WPSE user if had no read this answer).
So you can use WP_Query
with author__in
parameter in combination with array_keys
PHP function.
$paged = get_query_var( 'paged' ) ? get_query_var( 'paged' ) : 1;
$query = new WP_Query(
array( 'author__in' => array_keys( $following ), 'paged' => $paged )
);
while ( $query->have_posts() ) : $query->the_post();
// your loop here
endwhile;
wp_reset_postdata();
PS: you don’t need to open and close php tags on every line.
Related Posts:
- How to show list of posts by author and category?
- Find most recent authors
- Get the author of the latest revision
- Change all author links in Blog roll
- List of authors posts minus very latest
- show latest authors blog post
- How set featured posts using checkbox in post edit screen?
- Hook that get’s triggered when the author of a post is changed
- WP_Query: Why is sticky post not first item in loop?
- Skip post in loop and mixin later
- How to add editor’s name to entry meta byline?
- How to exclude latest x posts from a paginated query?
- Display content from a specific category
- Reverse chronology of post listing
- how to display full post with pagination on home page
- Get the user type of an author
- Show the title of the latest post by author
- This AJAX Code Doesn’t Work – Looking for elegant solution
- Filter posts by author and category simultaneously
- How to use alternate post layout at key points in post loop?
- Showing random content / pictures from earlier posts in a sticky post?
- Get all posts by post_author
- Authors in menu, template list post by author
- Double count view in archive.php
- Different style for most recent article
- Differentiate between posts and pages in search results
- Loop through all product posts?
- Show info to author only
- Converting a dynamic piece of code using WordPress Loop into a static one using Post ID
- Display post from current category and same tag?
- Inserting custom data to the_post() during loop
- Display post category in foreach loop with category link
- Displaying Latest Posts on a Page
- Display all posts that were published before full post on single.php
- Two loops, one AJAX loop, exclude posts in first loop from second loop, loops are in different files
- Get Image tag from content of post
- List authors with the last post title and order by last post date
- How to make the first post in the loop be styled like a “new / featured” post?
- “Right Way” to make custom Loop respect reading settings inside admin panel?
- Only display sticky post or latest post in custom loop
- How to order posts in an arbitrary order?
- Display Notification Bar on Header on Certain Post Count
- How to make a sum of all posts displayed in a loop
- How do I retrieve a users’ last 5 posts?
- why does wordpress ignore the post args?
- obtain the author id given the post id
- First x post with another template then the others
- Loop doesn’t show title of second post and posts thereafter
- Grid post page on WordPress with Bootstrap, the_excerpt(); Problem
- Loop parent terms {display posts} AND loop child terms {display posts}
- How to add a class to each individual post?
- add bootstrap post slider with tabs
- How to add add more properties to WP_Post object in search results loop
- static landing page leading to author specific pages w/ “live” content
- Add Blog to WP homepage Manually
- How can I remove the first two words and shorten get_the_title()
- How to show all posts by author on buddypress profile with navigation
- ACF to select posts not displaying on blog page
- How to add automatically bootstrap 4 order-lg-1 and order-lg-2 classes for columns in foreach loop based on the count?
- How to get the ability to change the author of a post
- Only allow posts with a specific term to only be viewed by other authors with the same term in their post
- How to limit author related post listing ?
- separate the post of a category by subcategory
- Get total post from an author
- WordPress loop not working on static front page
- Optimize CPT-function with a loop
- The loop starting at a certain ID
- Loop not showing first post
- Limiting the amount of posts retrieved by the loop
- Custom Post Type Single Loop Outputting Wrong Post
- Get current taxonomy and display query accordingly
- Error while excluding a post from another loop (using its ID)
- Restricting displayed posts to posts from only select authors
- Limit Post Creation Count by Author or Role
- Multiple post in One Loop in wordpress
- Diffrent layout for posts [duplicate]
- show loop id post , only first id can read
- Show post excerpt
- Wp_query loop is not working as it should
- Show author bio box
- Maximum number of posts per page before affecting performance?
- Use special template for the first post in the loop
- Display post order ranking within wordpress loop
- Problem with wp_insert_post()
- How to control Post view count incresing in sidebar widget posts too?
- Changing the Category for all posts of an Author
- Multiple Post Repeat for Related Post Loop by Category
- Where should get_post_meta() go to get $post->ID get_post_meta() is empty and $post->ID & get_the_id() are working
- Set the limit to allow author when make post!
- Is there a way to separate wordpress titles from their posts?
- adding custom meta as well as looping through posts
- Redirecting posts in WordPress to a specific page
- Notify Author of the post if admin deletes his post and perform some function
- ‘posts_per_page’ => ’10’ does not show any post
- When and how will php code in a user made WordPress page be executed?
- How can I add Author’s phone number to wp profile and make it appear in wp-admin/edit.php columns
- Query wordpress posts on static page
- View post with specific category id and name which I selected in the backend (drop-down option)
- WordPress Ajax load doesn’t work
- users followin the blog post author