Co-Authors Plugin Displaying Wrong Author

I’m using the Co-Authors Plugin and some posts have multiple authors:

in functions.php

Read More
function my_get_multiple_authors(){
  if ( function_exists( 'coauthors_posts_links' ) ) {
      coauthors_posts_links();
  } else {
      the_author_posts_link();
  }
}

in single.php

<span class="authors">By <?php my_get_multiple_authors(); ?></span>

which outputs 2 links

<a href="blahblah/author/johndoe">John Doe</a>
<a href="blahblah/author/janedoe">Jane Doe</a>

In my archive.php (the archive/author pages are basically the same):

<?php if( is_author() ) { ?>
    <h1><?php echo get_the_author(); ?></h1>
<?php } ?> 

<div class="posts">
    <?php if ( have_posts() ) : ?>
        <?php while ( have_posts() ) : the_post(); ?>
             <?php get_template_part( 'my_content_template' ); ?>
        <?php endwhile; ?>
        <?php else : ?>
    <?php endif; ?>
</div>

However, when I navigate to “blahblah/author/johndoe”, it outputs the wrong author. It ouputs <h1>Jane Doe</h1>

Any ideas?

Related posts

Leave a Reply