List Posts By A Co-Author

When using Co-Authors Plus, you may want to create a listing of all posts by a given co-author. Co-Authors Plus deviates slightly from how core WordPress works in that it stores byline information in a custom ‘author’ taxonomy. It works in this manner because a post (let it be a Post, Page, or Custom Post Type) can have multiple taxonomy terms associated with it.

To list some or all posts from a co-author, you’ll want to create a new WP_Query object based on the author term for a given user or guest author. Here’s an example of what that might look like:

// Build the query arguments
$args = array(
	'post_type' => 'post',
	'posts_per_page' => 10,
	'post_status' => 'publish',
	'author_name' => $user_login,
);
$author_query = new WP_Query( $args );

if ( $author_query->have_posts() ) :
	while ( $author_query->have_posts() ) : $author_query->the_post();

	// Do your presentation

	endwhile;
endif;

Ready to get started?

Tell us about your needs

Let us lead the way. We’ll help you select a top tier development partner. We’ll train your developers, operations, infrastructure, and editorial teams. We’ll coarchitect your deployment processes. We will provide live support for peak events. We’ll help your people avoid dark alleys and blind corners, and reduce wasted cycles.