Example – Show Related Posts for Custom Post Type in WordPress

0 90

Related posts in WordPress is the very useful to engage the audience of your website. WordPress gives you the capability to show the related posts of a specific post type. Display the related post of the article is very easy and you can add related posts list to your blog without using any plugin.

If you want to show related posts for custom post type, the posts need to be fetched by custom taxonomy terms of custom post type. In this tutorial, we will show how you can easily display the related posts for custom post type in WordPress. You don’t need to use any WordPress plugin for showing the related post of custom post type.

Generally, specific post details page (single.php) is used for custom post type. Open the single-custom_post_type.php file and place the following code where you want to display the related posts list of custom post type. This code will get posts of the same custom post type and same custom taxonomy terms of the current single post.

Specify the custom post type in post_type and custom taxonomy term of that post type in taxonomy. Also, specify the number of related posts in posts_per_page that you want to show.

You might also like More from author

Leave A Reply

Your email address will not be published.