I am using the Co-authors plus plugin on our web page because sometimes we have more authors of an article. It is working really fine until today. I used classic archive.php to list all posts of the author based on global settings (same post excerpt, thumbs, posts per page 6 – defined in global WordPress & theme PHPs). My authors requested to create theme profile pages with the list of all posts based on author.php
. So I was forced to overwrite global settings (posts per page 6) with new WP_Query
and here comes the problem with Co-authors plugin.
When I use the following code below the posts are listed only under author who is assigned as the main author but not listed under co-authors.
<?php
$the_query = new WP_Query(
array(
'posts_per_page' => -1,
'author' => get_the_author_meta('ID'),
)
);
if ( $the_query->have_posts() ) :
while ( $the_query->have_posts() ) : $the_query->the_post();
the_time('d.m.Y ');
the_permalink();
the_title();
endwhile;
wp_reset_postdata();
else :
_e( 'Sorry, no posts matched your criteria.' );
I tried to do it based on taxonomy
, author_name
, coauthor_meta
, etc, nothing helps.
You can see example here (sorry it's not in English): This article is not listed under both authors.
ID
in theget_the_author_meta()
and why are you not giving thefield
parameter to this function?