Displaying related posts by the same author is a pretty handy feature if you’re running a multi-author WordPress website. There are times when your visitors want to read contents from a specific author and it is possible to display related posts by the same author in WordPress. Today, at DevotePress, we will be showing you two different methods (by using a plugin and by manually) to display related posts by the same author in WordPress. So, without any further ado, let’s get right into the article.
Display Related Posts by the Same Author in WordPress Using a Plugin
To display related posts by the same author in WordPress using a WordPress plugin is quite easy and recommended for all users, including beginners.
In this method, the first thing you need to do is simply download and install the Similar Posts plugin from the WordPress plugin repository. Similar Posts is a plugin that displays a list of posts that are similar or related to the current posts and the list can be customized in many ways as well.
After installing and activating the plugin, you need to visit Settings > Similar Posts page to customize the plugin your way.
You will be able to see the General tab by default first. Here you can review the options and change them to match your requirements. You need to scroll down to the bottom and select “Yes” that’s next to the “Match the current post’s author” option. Also, you can uncheck other matching options to make sure that the plugin only displays posts by author.
Now, switch to the Placement tab and activate Output after post option. Also, you can edit the text in the Parameters to edit the output template.
Click on the Save Settings button once you’re done with the plugin customization process. Visit any single post on your website and you’ll be able to see the related posts after the post content by the same author after.
Now, let’s check out how we can display related posts by the same author in WordPress manually.
Display Related Posts by the Same Author in WordPress Manually
The second method is a little complicated than the first one as it requires you to add code to your WordPress theme file.
You need to open your currently activated theme, find the functions.php file, copy the below codes and paste it in your functions.php page.
function br_related_author_posts($content) { if (is_single) { global $authordata, $post; $content .= ' <h4>Similar Posts by The Author:</h4> '; $authors_posts = get_posts( array( 'author' => $authordata->ID, 'post__not_in' => array( $post->ID ), 'posts_per_page' => 5 ) ); $content .= ' <ul>'; foreach ( $authors_posts as $authors_post ) { $content .= ' <li><a href="' . get_permalink( $authors_post->ID ) . '">' . apply_filters( 'the_title', $authors_post->post_title, $authors_post->ID ) . '</a></li> '; } $content .= '</ul> '; return $content; } else { return $content; } } add_filter('the_content','wpb_related_author_posts');
The code will display 5 recent posts by the same author and it also makes sure that there are no other duplicates (the current posts will not be on the list). A simple trick that does the work without any hassle.
You can now visit the website and see the related posts by the same author.
Finally, we’ve come to an end of our article. We hope the above two methods helped you display related posts by the same author in WordPress. And, if you’re a beginner or don’t want to mess around with coding, then we suggest you use the first method to display the related posts by the same author.
If you have anything to add, ask or share, please leave your comments.