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
- Print Current Post Index number within Loop
- Should we trust the post globals?
- How to get posts published between a date and today?
- How set featured posts using checkbox in post edit screen?
- Hook that get’s triggered when the author of a post is changed
- the_author() returns empty string
- Get first post from wp_query
- Prevent Authors from viewing each others Posts
- Do we still need to include a “if (have_posts())” in templates?
- Display Random Author with Details in Sidebar
- WP_Query: Why is sticky post not first item in loop?
- Query *only* sticky posts
- Display all posts from specific categories on a page
- rewind_posts() – what actually the use of it, and where using is required or preferred?
- Skip post in loop and mixin later
- WordPress: How to get the current logged in author page URL?
- Override the default number of posts to show for a single loop?
- get comments and get posts in loop
- How to add editor’s name to entry meta byline?
- Different permalink for posts and authors
- How do I reorder (pop and push) items from WP_Query?
- How to exclude latest x posts from a paginated query?
- Display content from a specific category
- How to display posts by current user/author in a custom page template?
- Reverse chronology of post listing
- Query posts distinct authors
- Why do I need to use The Loop on pages (inside page.php etc)?
- posts page – different lengths of excerpt
- Restrict the Number of Posts an Author can Publish (over time)?
- WordPress Number of Posts Not Changing With posts_per_page
- Search posts by post author name
- how to display full post with pagination on home page
- Get the user type of an author
- Count singular post views automatically
- Show the title of the latest post by author
- Looping through posts per category gives same posts for each category
- This AJAX Code Doesn’t Work – Looking for elegant solution
- Show author post count in sidebar – Variable
- Display All Sticky Post Before Regular Post
- Cannot access current post’s ID in custom plugin
- Can’t show comments count per post outside loop
- Get current users post URL?
- Filter posts by author and category simultaneously
- How to have different content in the loop and single
- Custom Post Type & Author not associating, user post count is 0, api doesn’t return author in post objects
- Guest Author – How to modify my custom function code if the guest author URL will follow a particular pattern/format?
- Specific loop in Shortcode
- Strange switch_to_blog() issue
- Show a list of recently viewed posts to a user
- Multiple loops in same page, without duplicate content
- loop not displaying posts on custom template page
- Repost post on specific date every year
- How to use alternate post layout at key points in post loop?
- Post author is changed to admin after his post is modified by admin
- Alternate custom content in the loop
- Showing random content / pictures from earlier posts in a sticky post?
- Search widget breaks when using multiple loops?
- How to Display Post View Count
- Get all posts by post_author
- Displaying the number of posts in a custom loop (without including the number of posts of a loop below)?
- How can I control multiple editing of wordpress posts?
- Multiple authors for single post without plugin
- Limit number of posts a user can make per minute?
- Display Latest Post from all Categories
- Authors in menu, template list post by author
- Show the author’s count of total amount of posts assign to a custom taxonomy term
- Auto Refresh Post List after X seconds
- The correct way to call posts with ajax
- Author must complete profile info before they can publish a post?
- WP rest api returns 404 only when author param is used
- custom wordpress post loop – hide iframe content
- Double count view in archive.php
- Divide Loop Into Days & Categories
- How can I list random authors from current post category?
- Converting multiple loops into one single loop with pagination
- Display posts with comments closed, with pagination?
- Group posts by year in loop
- How would I get 1 latest post from a query for 5 posts?
- While in “the loop”, detect if a post is the most recent
- Alternating post layout
- Check to see if specific loop has less than certain amount of posts
- Different style for most recent article
- Contact form 7 post loop [closed]
- Differentiate between posts and pages in search results
- Related posts loop based on tags AND categories doesn’t work without at least one tag assigned
- Loop through all product posts?
- How to display different number of posts
- If Specific Post, Link Elsewhere
- How to filter posts that belong to a specific category only if that is the only category
- WP Query – duplicated posts once including tags in search results
- Most recent post from another database
- wp_tag_cloud() and the_taxonomies() work but not the_tag()
- How can I show wordpress posts based on author?
- Show info to author only