Find most recent authors

Use a custom SQL query to grab the latest 16 post IDs with unique authors;

$post_IDs = $wpdb->get_col( "SELECT ID FROM $wpdb->posts WHERE post_type="product" AND post_status="publish" GROUP BY post_author ORDER BY post_date DESC LIMIT 16" );

Then start up a new query with the post__in argument;

$recent_posts = new WP_Query( array( 'post__in' => $post_IDs, 'post_type' => 'product' ) );

Leave a Comment