WordPress GuidePost → 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:

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.

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:

Where to place the code

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:

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:

6. Troubleshoot related post issues

If something’s not working:

Ready to get started?

Get the fastest, most secure WordPress.org hosting on the market.

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.

Trust us to help you choose the ideal hosting solution

Loading form…