◦ Comprehensive security
◦ 24/7 support
WordPress Guide → Post → Add WordPress Related Posts
How to add WordPress related posts
Adding related posts to your WordPress site keeps visitors engaged longer, reduces bounce rate, and helps boost SEO through better internal linking. You’ve got multiple ways to do it—plugins, themes, and custom code—and the best choice depends on your site’s size and performance needs.
Get fast, reliable hosting for WordPress
Power your site with the industry’s fastest, most optimized WordPress hosting
What are related posts in WordPress?
Related posts are links to other articles on your site that are topically similar to the post a visitor is reading. They usually appear at the bottom of the content or in the sidebar and are generated based on tags, categories, or content similarity. This helps:
- Keep visitors on your site longer.
- Increase your page views per session.
- Improve your internal linking structure for better SEO.
Should you show related posts?
Related posts are helpful for blogs, news, tutorials, or any site with lots of content. But they’re not essential for every page. Avoid adding them to landing pages, product pages, or short content where it might distract or add clutter.
You should also consider site speed. Some related post plugins can slow down your site if they run complex database queries, especially on high-traffic sites.
1. Use a related posts plugin (most popular method)
This is the easiest way for most WordPress users. Plugins do the heavy lifting and usually come with settings to customize how posts are selected and displayed.
Jetpack Related Posts
Jetpack includes a Related Posts module that is free and handled off-site, meaning it won’t slow your server down.
To set it up:
- Go to Plugins → Add New, search for “Jetpack”, install and activate it.
- Follow the prompts to connect your site to a free WordPress.com account.
- In your WordPress dashboard, go to Jetpack → Settings → Traffic.
- Scroll down to Related posts and turn it on.
- You can choose to show thumbnails, display post dates, or include a custom header.
Jetpack uses WordPress.com’s servers to process related content, which keeps your site faster. But it does require a WordPress.com login.
Contextual Related Posts
Contextual Related Posts is a free WordPress plugin that automatically displays related posts on your site based on content and title matching, with options for thumbnail images and shortcode placement.
To use it:
- Go to Plugins → Add New, search for “Contextual Related Posts,” then install and activate it.
- After activation, go to Settings → Related Posts.
- Adjust options like number of posts to show, how they’re matched (title, content), and whether to show thumbnails.
- It automatically displays related posts after each post. You can also use the [crp] shortcode in pages or widgets.
This plugin is great if you want to avoid Jetpack and prefer local processing, but it may use more server resources.
Yet Another Related Posts Plugin (YARPP)
Yet Another Related Posts Plugin (YARPP) is a customizable WordPress plugin that shows related posts using a powerful algorithm based on content, titles, categories, and tags, with options for lists, thumbnails, or custom templates.
To set it up:
- Go to Plugins → Add New, search for “Yet Another Related Posts Plugin”, install and activate it.
- Go to Settings → YARPP.
- Choose how it calculates relatedness: categories, tags, title, and content.
- Pick a display format: list, thumbnails, or custom template.
- Enable automatic display or use the [yarpp] shortcode.
YARPP is powerful, but on large sites it can slow things down unless you use good caching.
2. Display related posts manually with custom code
If you’re comfortable editing theme files and want maximum control, you can write your own code.
Create a custom WP_Query
This snippet shows how to fetch related posts by shared category:
$categories = wp_get_post_categories(get_the_ID());
$args = array(
‘category__in’ => $categories,
‘post__not_in’ => array(get_the_ID()),
‘posts_per_page’ => 4
);
$related = new WP_Query($args);
if ($related->have_posts()) {
echo ‘<ul class=”related-posts”>’;
while ($related->have_posts()) {
$related->the_post();
echo ‘<li><a href=”‘ . get_permalink() . ‘”>’ . get_the_title() . ‘</a></li>’;
}
echo ‘</ul>’;
wp_reset_postdata();
}
Where to place the code
- In classic themes, paste the code at the bottom of single.php, just before the closing </article> or </main> tag.
- In block themes, add a custom template part or use a plugin like Code Snippets to insert it after post content.
3. Use your theme’s built-in related posts
Some WordPress themes come with built-in related post features. These are usually available in the theme settings or customizer.
To check:
- Go to Appearance → Customize or check your theme’s settings panel.
- Look under “Blog”, “Single Post”, or “Layout” sections.
- Enable related posts and choose display options (grid, list, thumbnails).
Themes that support this include Astra (Pro), Kadence, and GeneratePress with Elements.
4. Customize how related posts are displayed
Once related posts are working, you can adjust how they look and behave.
Control post count and order
Most plugins let you specify how many related posts to display. You’ll typically find this option in the plugin settings panel. For example, Jetpack allows you to show up to six related posts. In YARPP and CRP, you can set a specific number or even adjust relevance thresholds.
You can also influence the order in which related posts appear. Some plugins default to relevance, but offer options to sort by date, popularity, or even randomize the order. If you’re using custom code, modify the posts_per_page and orderby parameters in your WP_Query to suit your needs.
Change layout style
Plugins like YARPP and Contextual Related Posts let you choose between a list view or a thumbnail grid. Some themes and plugins include pre-designed templates, while others allow you to fully customize the output with your own HTML and CSS.
If you’re using Jetpack, the Related Posts block integrates with the block editor and inherits your theme’s styles. You can further customize it by applying additional CSS or using a child theme to override the default design. For more control, YARPP allows advanced users to create custom PHP templates for related posts.
Choose where to place related posts
Most plugins automatically place related posts below your post content. However, you can change the placement using widgets, shortcodes, or template files.
To show related posts in a sidebar or footer, use a plugin’s block or widget feature. Go to Appearance → Widgets, then drag the related posts widget into your desired area. Alternatively, use shortcodes like [yarpp] or [crp] directly in posts, pages, or reusable block templates.
If you’re using custom code, paste your query output wherever you want related posts to appear—typically in single.php, content-single.php, or a block theme template part.
5. Optimize performance
Related post plugins can add database load, especially on large sites.
Performance tips:
- Use Jetpack if you want to offload processing to external servers.
- Limit the number of posts shown (3–5 is ideal).
- Avoid fuzzy matching if your plugin allows.
- Enable object caching like Redis or use a performance plugin like WP Rocket.
6. Troubleshoot related post issues
If something’s not working:
- Nothing shows up: Make sure your posts are using tags or categories.
- Unrelated posts showing: Adjust matching settings to rely more on categories.
- Broken layout: Look for CSS conflicts with your theme. Try switching to a default theme to test.
- Slow site: Reduce post count or switch to a more efficient plugin like Jetpack.
Next steps for adding WordPress related posts
Related posts can quietly improve user engagement, SEO, and session duration with minimal effort. Whether you prefer a plug-and-play solution like Jetpack or want full control with custom code, there’s a method that fits every type of WordPress site.
Start by testing a plugin that matches your design goals and server setup. Then tweak the display for your audience and performance needs.
When you’re ready for professional hosting, Liquid Web can help. Our WordPress hosting options configure business-class servers and support plans specifically for WordPress websites.
Click through below to explore all of our WordPress hosting options, or chat with a WordPress expert right now to get answers and advice.
Additional resources
What is WordPress? →
A complete beginner’s guide to WordPress.org
What’s the difference between tags and categories in WordPress? →
Learn the key differences between WordPress tags and categories to better organize your website content.
Beginner’s Guide to WordPress themes →
Learn how they work, what to look for, how to choose, and more
Aaron Binders works as a Linux Support Technician at Liquid Web and focuses on resolving server-side customer issues. When not spending time with his family, he has a passion for sports such as football and boxing, as well as reading the latest ICT magazines.