A WordPress user recently reached out asking how to show related pages on their site, rather than posts. We've previously covered related posts using plugins or code. Here, we'll guide you through displaying related pages effectively, drawing from our extensive experience optimizing WordPress sites.
The simplest approach is a dedicated plugin like YARPP (Yet Another Related Posts Plugin). Install and activate it, then head to Settings » YARPP to configure.

In the Display options for your website section, under Show automatically, select 'pages' and uncheck posts and media. Save changes, and YARPP will automatically display related pages below your content.
Note: Some managed hosts block YARPP due to high database load. Also, it may not work with text matching if using MySQL InnoDB.
Before diving in, check our guide on WordPress posts vs. pages for context.
Pages lack tags/categories by default, so first install the 'Publish Tags and Categories for Pages' plugin. It activates instantly, enabling tags and categories on pages—no extra setup needed.
Edit related pages (e.g., 'About Us' and 'Company History') and assign shared tags like 'about-us'.
Add this reliable code to your theme's functions.php or a site-specific plugin:
function wpb_related_pages() {
global $post;
$orig_post = $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 '<h3>Related Pages</h3><ul>';
while ($my_query->have_posts()) {
$my_query->the_post();
?>
<li><a href="<?php the_permalink() ?>" rel="bookmark" title="<?php the_title(); ?>"><?php the_title(); ?></a></li>
<?php
}
echo '</ul>';
} else {
echo 'No related pages found.';
}
}
$post = $orig_post;
wp_reset_postdata();
}This queries pages sharing tags with the current one, excluding itself. To show the list, edit your page.php or content-page.php template and insert:
<?php wpb_related_pages(); ?>It'll appear on pages automatically. Style with CSS to match your theme.
Note: Functions.php code runs like a plugin—test on a staging site first.
We hope this helps enhance your site's navigation. Questions? Drop them in the comments. Follow us on Twitter for more tips.