How to Add and Display Multiple Authors on a WordPress Post

Looking for a tutorial on adding and displaying multiple authors on your WordPress Post?
This short hands-on tutorial will help you to achieve this.

As you see in the meta section of this post, I will explain the process of displaying two or more authors on your WordPress post.

I am sharing this tutorial on my personal experience – how I made it possible on this blog.

This process involves installing a lightweight dedicated plugin and a small code if you want to display multiple names publicly.

Video tutorial

If you prefer watching the screencasted step by step video for this tutorial then please watch the video attached below or scroll down to find the step by step guide.

Step by step guide

Setting up Co-Authors Plus plugin and adding users/ guest authors to post

Grow Your YouTube Channel with TubeBuddy. Join Today!
tubebuddy

For achieving our purpose, we will be installing a plugin called Co-Authors Plus. You can find details about this plugin on this plugin’s page.

  • once you are logged in to your website’s WordPress admin dashboard, open up the plugin section
  • Search for “Co-Authors Plus” after clicking on Add New option and install the plugin
multiple authors plugin in wordpress
  • once installed if you go to any post, you’ll notice the author section at the bottom of the composer as shown below
more than one author wordpress
  • here in the above author image, I can search for existing WordPress user or Guest User
  • With this plugin, you can add multiple guest authors without the need of creating additional WordPress user accounts.
    – If you want to add guest users, just hover over to your User Menu to find Guest Authors
guest authors in wordpress dashboard

– You can provide the guest author details and also set avatar
– once the guest author is added, if you go to your WordPress post editor and navigate to the bottom section, you can add the guest author to the post by doing a simple search

Get $100 Credit on DigitalOcean.  Join Now!

Even though we could add users and guest authors to our post there still lies a problem. The problem being the multiple authors’ names aren’t displayed along with the post meta.

How can this be solved?
We will solve this by adding few lines of code!

If you don’t need need to display the names of all authors then you don’t need to follow the code below.

Since you are here,
stay connected by subscribing today!
Instead of spamming your inbox, I guarantee you’ll only receive what you expect to receive. details

How to display more than one authors for a WordPress post?

According to the plugin’s description, it says to “use the use the Co-Authors Plus template tags to list co-authors anywhere you’d normally list the author”. This documentation explains what we are doing and what we need to do.

Basically, it advises us to replace existing author template tags like the_author() and the_author_posts_link() which can be found in theme files like single.php and author.php with coauthors_posts_links().

if ( function_exists( 'coauthors_posts_links' ) ) {
    coauthors_posts_links();
} else {
    the_author_posts_link();
}

I know, by this time you are trying hard to find the above template tags in your theme files. If you don’t know where to find these files, look at Appearance -> Theme Editor.

Even after adding the above code, you couldn’t figure out why isn’t it working, follow the step below.

For this, I tried configuring with the default WordPress version (5.7.2) and theme (Twenty Twenty One) that came with the default WordPress installation. (available as of when writing this article)

If you look at the official documentation, there are a couple of examples for adjusting this setting for different themes. As this might depend on individual themes, I chose the default WP theme to make it easier to understand and modify.

The given function in the documentation is for the TwentyTen WP theme, I modified it to work to Twenty Twenty-One. All I did was changed the template-tags file ()inc/template-tags.php) to adapt to the official documentation( twentyten to twenty_twenty_one.
This is what it looked like

if ( ! function_exists( 'twenty_twenty_one_posted_on' ) ) :
	/**
	 * Integrate Co-Authors Plus with TwentyTen by replacing twentyten_posted_on() with this function.
	 */
	function twenty_twenty_one_posted_on() {
		if ( function_exists( 'coauthors_posts_links' ) ) :
			printf(
				__( '<span class="%1$s">Posted on</span> %2$s <span class="meta-sep">by</span> %3$s', 'twentyten' ),
				'meta-prep meta-prep-author',
				sprintf(
					'<a href="%1$s" title="%2$s" rel="bookmark"><span class="entry-date">%3$s</span></a>',
					get_permalink(),
					esc_attr( get_the_time() ),
					get_the_date()
				),
				coauthors_posts_links( null, null, null, null, false )
			);
		else:
			printf(
				__( '<span class="%1$s"<Posted on</span> %2$s <span class="meta-sep">by</span> %3$s', 'twenty_twenty_one' ),
				'meta-prep meta-prep-author',
				sprintf(
					'<a href="%1$s" title="%2$s" rel="bookmark"><span class="entry-date">%3$s</span></a>',
					get_permalink(),
					esc_attr( get_the_time() ),
					get_the_date()
				),
				sprintf(
					'<span class="author vcard"><a class="url fn n" href="%1$s" title="%2$s">%3$s</a></span>',
					get_author_posts_url( get_the_author_meta( 'ID' ) ),
					esc_attr( sprintf( __( 'View all posts by %s', 'twenty_twenty_one' ), get_the_author() ) ),
					get_the_author()
				)
			);
		endif;
	}
endif;

You can see that I left the comment unchanged.
If you are having trouble from where to where to make changes then place the above code in between the start of the template-tags.php file after the comment and before this line

if ( ! function_exists( 'twenty_twenty_one_entry_meta_footer' ) ) {

Once you have made changes, make sure you save the changes.

Get $100 Credit on DigitalOcean.  Join Now!

By now If you refresh your post, you’ll see the authors’ number has changed. 😀

Let me know if this worked for you.

Resources

Co-Authors Plushttps://wordpress.org/plugins/co-authors-plus/
Integrating template tags into your themehttps://docs.wpvip.com/technical-references/plugins/incorporate-co-authors-plus-template-tags-into-your-theme/
How to Add Multiple Authors (Co-Authors) for Posts in WordPresshttps://www.wpbeginner.com/plugins/allow-multiple-authors-to-be-associated-with-a-post-in-wordpress/

Before you go, let's stay connected
Photo of author
About the Author
Lakshman Basnet
Digital Media Marketer from Nepal currently based in Adelaide, South Australia who apart from playing with his cat - Eleven, also enjoys developing web content, publishing blogs and YouTube videos in his free time.

2 thoughts on “How to Add and Display Multiple Authors on a WordPress Post”

  1. Hi Lakshman,

    Thanks for the amazing blog, this is exactly what I was looking for, however I can’t add co author to a post for some reason, when I search for the Guest author inside the author search box, the Author name appears but I can’t add it to the post even after clicking several times,
    Your reply will be very helpful

    Reply

Leave a comment