How to Show Related Pages in WordPress

How to Show Related Pages in WordPress

Displaying related pages on your WordPress site is a smart way to keep visitors engaged, reduce bounce rates, and strengthen internal linking for better SEO. Unlike posts, pages don’t have built-in categories or tags, so showing related content requires plugins or custom code. At Cope Business, we often implement related content features during our technical SEO audit services to help clients improve site navigation and rankings. This guide covers two effective methods to add related pages, with step-by-step instructions suitable for beginners.

Whether you’re running a business site, knowledge base, or blog, related pages can highlight important content and encourage deeper exploration.

Why Show Related Pages in WordPress?

  • Improves user experience by suggesting relevant content.
  • Increases pageviews and time on site.
  • Boosts SEO through internal links and better crawlability.
  • Reduces bounce rates by keeping visitors longer.

Pages like “About Us” or “Services” can link to related ones like “Contact” or “Pricing” for better flow.

Method 1: Using the Yet Another Related Posts Plugin (YARPP)

YARPP is a free, powerful plugin that automatically suggests related pages based on an advanced algorithm.

Step-by-Step Setup

  1. Install and activate YARPP from Plugins > Add New.
  2. Go to Settings > YARPP to configure.
  3. In the Relatedness Options section, check the Pages box to include them in calculations.
  4. Adjust the Match threshold (start at 1–5; higher is stricter).
  5. Customize the algorithm by weighting titles, bodies, categories, and tags.
  6. In Automatic Display Options, select where to show (posts, pages, media), max items (e.g., 5), theme (list, thumbnails, custom), and order (score, date, title).
  7. Enable RSS feed integration and REST API if needed for apps.
  8. Save changes—related pages will appear automatically at the bottom of your content.

Tips: If your host blocks YARPP due to database load, switch to a managed provider like SiteGround. Test on a staging site first.

Method 2: Manually with Code Using Tags and Custom Taxonomy

This no-plugin method adds tags to pages and uses code to query related ones—lightweight and customizable.

Step-by-Step Setup

  • Install and activate the Pages with category and tag plugin to enable tags on pages.
  • Edit your pages and add relevant tags (e.g., “company” for About, Privacy, Contact pages).
  • Install WPCode (free) for safe code addition.
  • Go to Code Snippets > Add Snippet and create a new one (e.g., “Related Pages”).
  • Paste this PHP code in the snippet:
PHPfunction wpb_related_pages() { $orig_post = $post; global $post; $tags = wp_get_post_tags($post->ID); if ($tags) { $tag_ids = array(); foreach($tags as $individual_tag) $tag_ids[] = $individual_tag->term_id; $args=array( 'post_type' => 'page', 'tag__in' => $tag_ids, 'post__not_in' => array($post->ID), 'posts_per_page'=>5 ); $my_query = new WP_Query( $args ); if( $my_query->have_posts() ) { echo '<div id="relatedpages"><h3>Related Pages</h3><ul>'; while( $my_query->have_posts() ) { $my_query->the_post(); ?> <li><div class="relatedthumb"><a href="<? the_permalink()?>" rel="bookmark" title="<?php the_title(); ?>"><?php the_post_thumbnail('thumb'); ?></a></div> <div class="relatedcontent"> <h3><a href="<? the_permalink()?>" rel="bookmark" title="<?php the_title(); ?>"><?php the_title(); ?></a></h3> <?php the_time('M j, Y') ?> </div> </li> <? } echo '</ul></div>'; } else { echo "No Related Pages Found:"; } } $post = $orig_post; wp_reset_query(); }
  • Set the snippet to active and save.
  • Edit your page template (e.g., page.php in a child theme) and insert <?php wpb_related_pages(); ?> where you want the section to appear.

Tips: Add tags to at least a few pages first to see results. Customize CSS for styling thumbnails and lists. This method is lighter on resources than plugins.

Additional Tips for Related Pages

  • Test Performance: Ensure the feature doesn’t slow your site—use caching plugins like WP Rocket.
  • SEO Boost: Related links improve internal linking—optimize with keywords in anchors.
  • Mobile-Friendly: Check display on phones; thumbnails should be responsive.
  • Customization: For advanced algorithms, YARPP Pro adds more options.
  • Alternatives: If focusing on posts, consider Contextual Related Posts plugin.

Implementing related pages can significantly enhance engagement and SEO on your site.

Need help adding this feature or optimizing your WordPress setup? Contact Cope Business for a free technical SEO consultation—we’ll review your site and provide tailored solutions.

Was this article helpful?
YesNo