How to Display Related Posts in WordPress600

Author: InfoBeep - December 14, 2017 | subject to copyright

Displaying related posts adds flavor to your site. It helps you get more viewer attention and attracts viewer to some other articles in your page. In addition, it helps you decrease your bounce rate. Now, if you want to display related post in WordPress this is what you need to do.


Simply copy and paste the code below in your single.php where you find its relevant to display related post.


//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= newWP_Query($args);

if( $my_query->have_posts() ) {

while($my_query->have_posts()) : $my_query->the_post(); ?>

<a href="<?phpthe_permalink() ?>"rel="bookmark"title="Permanent Link to <?phpthe_title_attribute(); ?>"><?phpthe_title(); ?></a>







Source: MichaelH

Note: the above plugin is called Yet Another Related Post Plugin (YARP)