How to Display Related Posts in WordPress With and Without Plugins

How to Display Related Posts in WordPress With and Without Plugins

Displaying related posts is an effective way to attract your visitors to check out your site and stick around. It can help decrease your bounce rate, increase page views and also grow your AdSense income. This article will show you how to display related posts in your blog by keeping everything simple, light and accessible. Let’s get started!

There are two ways to add related posts; you can use a plugin or go without.

Displaying related posts in WordPress without plugin

Using too many plugins may run the risk of spoiling your WordPress blog; at the very worst, it may break your blog down. Some plugins are not compatible with one another, and adding more plugins may slow down your blog. To avoid these sorts of problems, you can display related posts by using code.  Just paste the following code in single.php where you want to display your related posts.

//for use in the loop, list 5 post titles related to first tag on current post
$tags = wp_get_post_tags($post->ID);
if ($tags) {
echo 'Related Posts';
$first_tag = $tags[0]->term_id;
'tag__in' => array($first_tag),
'post__not_in' => array($post->ID),
$my_query = new WP_Query($args);
if( $my_query->have_posts() ) {
while ($my_query->have_posts()) : $my_query->the_post(); ?>
<a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a>


 Displaying Related Posts in WordPress with a Plugin

One of the great benefits of using WordPress are the plugins. WordPress plugins cover almost everything you can think of, from expanding your blog into a CMS to adding stylish features and optimizing for search engines, and more. The possibilities are endless. Now, as noted above, if you use too many it can slow down or even break your site; however, used appropriately, plugins are very powerful.

Yet Another Related Post Plugin (YARPP) is one useful plugin which provides a list of posts/pages related to the current entry, and informs the visitors regarding relevant content on your site.

The following features are available in YARPP:

  • Thumbnails: A beautiful new thumbnail display, for themes which use post thumbnails (featured images). New in YARPP 4.
  • Related posts, pages, and custom post types: Puts you in control of pulling up related posts, pages, or both.
  • Templating: The YARPP templating system gives you advanced control of how your results are displayed.
  • An advanced and versatile algorithm: Using a customizable algorithm considering post titles, content, tags, categories, and custom taxonomies, YARPP finds related content from across your site.
  • Caching: YARPP is performant, caching related post data as your site is visited.
  • Related posts in feeds: Displays related posts in RSS feeds with custom display options.

This plugin requires PHP 5, MySQL 4.1, and WordPress 3.3 or greater.


Community-based and focused on all things WordPress!

Leave a Reply

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

How to Display Related Posts in WordPress With and Without Plugins

by WPSolution time to read: 2 min