You need to GROUP BY the author ID, which is going to require a filter on posts_groupby. The Codex page for that filter is non-existent but it works like posts_join. Something like…
function filter_authors($groupby) {
global $wpdb;
$groupby = " {$wpdb->posts}.post_author";
return $groupby;
}
add_filter('posts_groupby','filter_authors');
$args = array(
'showposts' => 3,
'author' => "1,2,3"
);
$the_query = new WP_Query( $args );
while ( $the_query->have_posts() ) : $the_query->the_post();
echo $post->post_title.' :: '.$post->post_author."<br/>";
endwhile;
Use your own values in $args of course.
that will effect any other query on the page that runs after this block of code. You might want to remove the filter after you are done.
remove_filter('posts_groupby','filter_authors');
Related Posts:
- author.php with ACF and CPTs
- Show only oldest post by author
- Function to check if author has posted within the last x days
- Show one post per author and limit query to 8 posts
- Pagination 404 errors for author posts query on author.php
- Only display authors who have posts
- Get List of all the Authors
- How can I display list of all posts from a specific author, with publish dates in the future, on an author archive page (author.php)?
- Get authors by term id or slug
- Dynamic User Id
- Custom Query by Author field and meta
- slow WP_Query for non-admin user
- WP_Query (list) posts according to author’s custom field
- Exclude some authors from query
- Get author if post has multiple authors
- All posts returned when author of 0 is queried
- Posts in loop all show the same author when there are many authors
- Stomping WP_Query in author archive to facilitate pagination with custom queries
- Display if author page is author page of current user
- Exclude authors IDs from WP_Query
- WP_Query author parameter not working
- query post by author gender
- How can i show pagenavi in my author.php?
- wp query to use both author id and meta_query
- Counting instances of words in the results of a post query
- Query posts by post type, author and post meta
- Get authors list and sort them by recent posts
- query all posts published by certain user id
- WP Query get posts by specific author IDs if one of several logged in authors
- meta_compare not comparing whole integer
- WP_Query – Object manipulation vs WordPress functions
- Only display post if published in last 24 hours?
- Transients with dynamic WP_Query
- How to remove the most recent post from $the_query
- WP_Query loop else statement not executing
- Modify Search Query if original Query gave no results
- How to cache wp_query with pagination using transients?
- Problem with WP_query
- Why is WP_Query not displaying expected data?
- Filter post query to only show direct children of category
- Selecting posts with a given meta value for a meta key
- Get every post with value in meta key
- pre_get_posts – editing query, tax_query
- Check if a post has term inside loop
- Display all posts in a custom post type, grouped by a custom taxonomy. How to sort the posts alphabetically and the terms by ID?
- How do I add a relation parameter to my filter query?
- Hacking ‘posts_per_page’ in WP_Query
- How to get posts by category and by choosing a taxonomy term?
- Query outputting YouTube url rather than embedded video
- Paginate pages with dynamic query
- WP_Query loop doen’t work with my custom taxonomy
- wp list pages using meta box value
- get_var is neither a string, integer, or array …?
- Deleting terms from the WordPress wp terms table
- Can I get one wp_query to double order like this?
- In a WP_Query can I force the results’ is_singular() to be set to false?
- Sort custom post by custom field if none order by latest release
- Order (by ASC) posts with meta_key so posts without values are last
- how to include orderby value that is empty?
- Why can my filter query SOME metadata but not other metadata?
- WordPress Carousel with recive posts (Bootstrap)
- Custom query showing all acf field values instead of the one searched
- Pagination Shows Up But Won’t Work on Custom Gallery Page
- How can I use WP_Query to sort ‘event’ custom post type by date?
- posts_per_page in a tax_query
- Modify a query with no results in pre_get_posts
- WP_Query: custom orderby (not ASC nor DESC)
- Show posts from categories instead of tags
- Sorting Posts by Taxonomy thats not within the query’s $args
- Orderby query does not work for custom fields even with meta query
- Query by Category and Custom Field – Shortcode
- Querying posts with meta key and meta value not returning anything
- WP_Query a custom field value bringing back 0 results
- Set Transient on CPT
- Why is $wp_query fetching nothing?
- How to query post into a complex slider
- Year based WP Query
- Horizontally paginate through sets of blog posts?
- WP_Query Sorting Posts by month … timeline effect
- Comments orderby comment date not working
- Switched from query_posts to wp_query, pagination no longer working
- When importing a database any page with a wp_query in doesn’t work
- My class function is not seeing GET url paramaters
- Wp query by 2 meta field – check if they exists / have value
- Adding css tweak based on page template
- Standard Loop – wp_query
- Why wp_query return 1 row if i have 3 row pass in it
- How does ‘category__not_in’ differ to cat => ‘-1’?
- Custom Wp_query loop takes very long
- How to display only top posts of parent categories in loop via WP_Query?
- Empty query on Custom Post Type, using WP_Query or get_posts
- Give attachments an archive page, and exclude unattached ones
- The permalink redirecting to current article on single.php page
- Variations as Single Products [closed]
- Bulk delete comments, foreach loop
- Send a variable with a URL and get a variable with Wp query
- Showing Counts on Comment List with Custom Query
- Group users by meta field, with name of meta field as group title
- How do I group results from wp-query
- How could i add username field in WooCommerce