How to use WP_Query with Co Authors Plus

I have a site which have some authors who are normal WordPress users, but also some are using the Co Authors Plug plugin. When I make a WP_Query like this, it only returns results for the wordpress users:

$writer = ‘juan-villegas’;

$q = new WP_Query( [
‘post_type’ => ‘post’,
‘author_name’ => $writer,
‘posts_per_page’ => 3,
] );

It is perplexing because if I put in a valid author_name who is listed as co-author on several posts, it does not output anything, but I’m sure that it should, and if I put in an author slug for a normal WordPress user, it works fine.

Read more here:: How to use WP_Query with Co Authors Plus

Leave a Reply

Your email address will not be published. Required fields are marked *