{"id":2479,"date":"2017-05-23T19:01:25","date_gmt":"2017-05-23T19:01:25","guid":{"rendered":"https:\/\/www.codexworld.com\/?p=2479"},"modified":"2017-05-23T19:01:25","modified_gmt":"2017-05-23T19:01:25","slug":"wordpress-custom-post-type-related-posts","status":"publish","type":"post","link":"https:\/\/www.codexworld.com\/wordpress-custom-post-type-related-posts\/","title":{"rendered":"How to Show Related Posts for Custom Post Type in WordPress"},"content":{"rendered":"<p><b>Related posts in WordPress<\/b> 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.<\/p>\n<p>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 <b>display the related posts for custom post type in WordPress<\/b>. You don&#8217;t need to use any WordPress plugin for showing the related post of custom post type.<\/p>\n<p>Generally, specific post details page (single.php) is used for custom post type. Open the <code>single-custom_post_type.php<\/code> 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.<\/p>\n<pre><span style=\"color: #0000BB\">&lt;?php\r\n<br \/><\/span><span style=\"color: #FF8000\">\/\/get&nbsp;the&nbsp;taxonomy&nbsp;terms&nbsp;of&nbsp;custom&nbsp;post&nbsp;type<br \/><\/span><span style=\"color: #0000BB\">$customTaxonomyTerms&nbsp;<\/span><span style=\"color: #007700\">=&nbsp;<\/span><span style=\"color: #0000BB\">wp_get_object_terms<\/span><span style=\"color: #007700\">(&nbsp;<\/span><span style=\"color: #0000BB\">$post<\/span><span style=\"color: #007700\">-&gt;<\/span><span style=\"color: #0000BB\">ID<\/span><span style=\"color: #007700\">,&nbsp;<\/span><span style=\"color: #DD0000\">'your_taxonomy'<\/span><span style=\"color: #007700\">,&nbsp;array(<\/span><span style=\"color: #DD0000\">'fields'&nbsp;<\/span><span style=\"color: #007700\">=&gt;&nbsp;<\/span><span style=\"color: #DD0000\">'ids'<\/span><span style=\"color: #007700\">)&nbsp;);\r\n<br \/><\/span><span style=\"color: #FF8000\">\/\/query&nbsp;arguments<br \/><\/span><span style=\"color: #0000BB\">$args&nbsp;<\/span><span style=\"color: #007700\">=&nbsp;array(<br \/>&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #DD0000\">'post_type'&nbsp;<\/span><span style=\"color: #007700\">=&gt;&nbsp;<\/span><span style=\"color: #DD0000\">'your_custom_post_type'<\/span><span style=\"color: #007700\">,<br \/>&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #DD0000\">'post_status'&nbsp;<\/span><span style=\"color: #007700\">=&gt;&nbsp;<\/span><span style=\"color: #DD0000\">'publish'<\/span><span style=\"color: #007700\">,<br \/>&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #DD0000\">'posts_per_page'&nbsp;<\/span><span style=\"color: #007700\">=&gt;&nbsp;<\/span><span style=\"color: #0000BB\">5<\/span><span style=\"color: #007700\">,<br \/>&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #DD0000\">'orderby'&nbsp;<\/span><span style=\"color: #007700\">=&gt;&nbsp;<\/span><span style=\"color: #DD0000\">'rand'<\/span><span style=\"color: #007700\">,<br \/>&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #DD0000\">'tax_query'&nbsp;<\/span><span style=\"color: #007700\">=&gt;&nbsp;array(<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;array(<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #DD0000\">'taxonomy'&nbsp;<\/span><span style=\"color: #007700\">=&gt;&nbsp;<\/span><span style=\"color: #DD0000\">'your_custom_taxonomy'<\/span><span style=\"color: #007700\">,<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #DD0000\">'field'&nbsp;<\/span><span style=\"color: #007700\">=&gt;&nbsp;<\/span><span style=\"color: #DD0000\">'id'<\/span><span style=\"color: #007700\">,<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #DD0000\">'terms'&nbsp;<\/span><span style=\"color: #007700\">=&gt;&nbsp;<\/span><span style=\"color: #0000BB\">$customTaxonomyTerms<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #007700\">)<br \/>&nbsp;&nbsp;&nbsp;&nbsp;),<br \/>&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #DD0000\">'post__not_in'&nbsp;<\/span><span style=\"color: #007700\">=&gt;&nbsp;array&nbsp;(<\/span><span style=\"color: #0000BB\">$post<\/span><span style=\"color: #007700\">-&gt;<\/span><span style=\"color: #0000BB\">ID<\/span><span style=\"color: #007700\">),<br \/>);\r\n<br \/><\/span><span style=\"color: #FF8000\">\/\/the&nbsp;query<br \/><\/span><span style=\"color: #0000BB\">$relatedPosts&nbsp;<\/span><span style=\"color: #007700\">=&nbsp;new&nbsp;<\/span><span style=\"color: #0000BB\">WP_Query<\/span><span style=\"color: #007700\">(&nbsp;<\/span><span style=\"color: #0000BB\">$args&nbsp;<\/span><span style=\"color: #007700\">);\r\n<br \/><\/span><span style=\"color: #FF8000\">\/\/loop&nbsp;through&nbsp;query<br \/><\/span><span style=\"color: #007700\">if(<\/span><span style=\"color: #0000BB\">$relatedPosts<\/span><span style=\"color: #007700\">-&gt;<\/span><span style=\"color: #0000BB\">have_posts<\/span><span style=\"color: #007700\">()){<br \/>&nbsp;&nbsp;&nbsp;&nbsp;echo&nbsp;<\/span><span style=\"color: #DD0000\">'&lt;ul&gt;'<\/span><span style=\"color: #007700\">;<br \/>&nbsp;&nbsp;&nbsp;&nbsp;while(<\/span><span style=\"color: #0000BB\">$relatedPosts<\/span><span style=\"color: #007700\">-&gt;<\/span><span style=\"color: #0000BB\">have_posts<\/span><span style=\"color: #007700\">()){&nbsp;<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #0000BB\">$relatedPosts<\/span><span style=\"color: #007700\">-&gt;<\/span><span style=\"color: #0000BB\">the_post<\/span><span style=\"color: #007700\">();<br \/><\/span><span style=\"color: #0000BB\">?&gt;<br \/><\/span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;<span style=\"color:#bf4f24\">li<\/span>>&lt;<span style=\"color:#bf4f24\">a<\/span>\u00a0<span style=\"color:#bf4f24\">href<\/span>=<span style=\"color:#0b6125\">\"<span style=\"color: #0000BB\">&lt;?php&nbsp;the_permalink<\/span><span style=\"color: #007700\">();<\/span><span style=\"color: #0000BB\"> ?&gt;<\/span>\"<\/span>><span style=\"color: #0000BB\">&lt;?php&nbsp;the_title<\/span><span style=\"color: #007700\">();<\/span><span style=\"color: #0000BB\"> ?&gt;<\/span>&lt;\/<span style=\"color:#bf4f24\">a<\/span>>&lt;\/<span style=\"color:#bf4f24\">li<\/span>><br \/><span style=\"color: #0000BB\">&lt;?php<br \/>&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #007700\">}<br \/>&nbsp;&nbsp;&nbsp;&nbsp;echo&nbsp;<\/span><span style=\"color: #DD0000\">'&lt;\/ul&gt;'<\/span><span style=\"color: #007700\">;<br \/>}else{<br \/>&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #FF8000\">\/\/no&nbsp;posts&nbsp;found<br \/><\/span><span style=\"color: #007700\">}\r\n<br \/><\/span><span style=\"color: #FF8000\">\/\/restore&nbsp;original&nbsp;post&nbsp;data<br \/><\/span><span style=\"color: #0000BB\">wp_reset_postdata<\/span><span style=\"color: #007700\">();\r\n<br \/><\/span><span style=\"color: #0000BB\">?&gt;<\/span><\/pre>\n<p>Specify the custom post type in <code>post_type<\/code> and custom taxonomy term of that post type in <code>taxonomy<\/code>.  Also, specify the number of related posts in <code>posts_per_page<\/code> that you want to show.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>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 <\/p>\n","protected":false},"author":1,"featured_media":2480,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[5],"tags":[25],"class_list":["post-2479","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-wordpress","tag-wordpress","cat-5-id","has_thumb"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.4 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>How to Show Related Posts for Custom Post Type in WordPress - CodexWorld<\/title>\n<meta name=\"description\" content=\"WordPress custom post type related posts - Learn how to show related posts for custom post type in WordPress. Use our code in single post page to get the related posts of the custom posts type.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.codexworld.com\/wordpress-custom-post-type-related-posts\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How to Show Related Posts for Custom Post Type in WordPress - CodexWorld\" \/>\n<meta property=\"og:description\" content=\"WordPress custom post type related posts - Learn how to show related posts for custom post type in WordPress. Use our code in single post page to get the related posts of the custom posts type.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.codexworld.com\/wordpress-custom-post-type-related-posts\/\" \/>\n<meta property=\"og:site_name\" content=\"CodexWorld\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/codexworld\" \/>\n<meta property=\"article:author\" content=\"https:\/\/www.facebook.com\/codexworld\" \/>\n<meta property=\"article:published_time\" content=\"2017-05-23T19:01:25+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.codexworld.com\/wp-content\/uploads\/2017\/05\/custom-post-type-related-posts-wordpress-codexworld.png\" \/>\n\t<meta property=\"og:image:width\" content=\"1366\" \/>\n\t<meta property=\"og:image:height\" content=\"768\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"CodexWorld\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@codexworldblog\" \/>\n<meta name=\"twitter:site\" content=\"@codexworldweb\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"CodexWorld\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"3 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/wordpress-custom-post-type-related-posts\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/wordpress-custom-post-type-related-posts\\\/\"},\"author\":{\"name\":\"CodexWorld\",\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/#\\\/schema\\\/person\\\/9da51d8fa3cdefeb5ec9c69136d4baf0\"},\"headline\":\"How to Show Related Posts for Custom Post Type in WordPress\",\"datePublished\":\"2017-05-23T19:01:25+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/wordpress-custom-post-type-related-posts\\\/\"},\"wordCount\":211,\"commentCount\":7,\"publisher\":{\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/#organization\"},\"image\":{\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/wordpress-custom-post-type-related-posts\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.codexworld.com\\\/wp-content\\\/uploads\\\/2017\\\/05\\\/custom-post-type-related-posts-wordpress-codexworld.png\",\"keywords\":[\"WordPress\"],\"articleSection\":[\"WordPress\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.codexworld.com\\\/wordpress-custom-post-type-related-posts\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/wordpress-custom-post-type-related-posts\\\/\",\"url\":\"https:\\\/\\\/www.codexworld.com\\\/wordpress-custom-post-type-related-posts\\\/\",\"name\":\"How to Show Related Posts for Custom Post Type in WordPress - CodexWorld\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/wordpress-custom-post-type-related-posts\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/wordpress-custom-post-type-related-posts\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.codexworld.com\\\/wp-content\\\/uploads\\\/2017\\\/05\\\/custom-post-type-related-posts-wordpress-codexworld.png\",\"datePublished\":\"2017-05-23T19:01:25+00:00\",\"description\":\"WordPress custom post type related posts - Learn how to show related posts for custom post type in WordPress. Use our code in single post page to get the related posts of the custom posts type.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/wordpress-custom-post-type-related-posts\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.codexworld.com\\\/wordpress-custom-post-type-related-posts\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/wordpress-custom-post-type-related-posts\\\/#primaryimage\",\"url\":\"https:\\\/\\\/www.codexworld.com\\\/wp-content\\\/uploads\\\/2017\\\/05\\\/custom-post-type-related-posts-wordpress-codexworld.png\",\"contentUrl\":\"https:\\\/\\\/www.codexworld.com\\\/wp-content\\\/uploads\\\/2017\\\/05\\\/custom-post-type-related-posts-wordpress-codexworld.png\",\"width\":1366,\"height\":768,\"caption\":\"custom-post-type-related-posts-wordpress-codexworld\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/wordpress-custom-post-type-related-posts\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.codexworld.com\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"How to Show Related Posts for Custom Post Type in WordPress\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/#website\",\"url\":\"https:\\\/\\\/www.codexworld.com\\\/\",\"name\":\"CodexWorld\",\"description\":\"Web &amp; Mobile App Development Company\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.codexworld.com\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/#organization\",\"name\":\"CodexWorld\",\"url\":\"https:\\\/\\\/www.codexworld.com\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/www.codexworld.com\\\/wp-content\\\/uploads\\\/2014\\\/09\\\/codexworld-logo.png\",\"contentUrl\":\"https:\\\/\\\/www.codexworld.com\\\/wp-content\\\/uploads\\\/2014\\\/09\\\/codexworld-logo.png\",\"width\":200,\"height\":19,\"caption\":\"CodexWorld\"},\"image\":{\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/#\\\/schema\\\/logo\\\/image\\\/\"},\"sameAs\":[\"https:\\\/\\\/www.facebook.com\\\/codexworld\",\"https:\\\/\\\/x.com\\\/codexworldweb\",\"https:\\\/\\\/www.linkedin.com\\\/company\\\/codexworld\",\"https:\\\/\\\/www.youtube.com\\\/codexworld\"]},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/#\\\/schema\\\/person\\\/9da51d8fa3cdefeb5ec9c69136d4baf0\",\"name\":\"CodexWorld\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/cf4999db3b409de559f80677afa01729bb2eeda19be273c254e8b2c22729e386?s=96&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/cf4999db3b409de559f80677afa01729bb2eeda19be273c254e8b2c22729e386?s=96&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/cf4999db3b409de559f80677afa01729bb2eeda19be273c254e8b2c22729e386?s=96&r=g\",\"caption\":\"CodexWorld\"},\"description\":\"CodexWorld is a programming blog, one-stop destination for web professionals \u2014 developers, programmers, freelancers, and site owners.\",\"sameAs\":[\"http:\\\/\\\/www.codexworld.com\",\"https:\\\/\\\/www.facebook.com\\\/codexworld\",\"https:\\\/\\\/x.com\\\/codexworldblog\"],\"url\":\"https:\\\/\\\/www.codexworld.com\\\/author\\\/nitya192265\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"How to Show Related Posts for Custom Post Type in WordPress - CodexWorld","description":"WordPress custom post type related posts - Learn how to show related posts for custom post type in WordPress. Use our code in single post page to get the related posts of the custom posts type.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.codexworld.com\/wordpress-custom-post-type-related-posts\/","og_locale":"en_US","og_type":"article","og_title":"How to Show Related Posts for Custom Post Type in WordPress - CodexWorld","og_description":"WordPress custom post type related posts - Learn how to show related posts for custom post type in WordPress. Use our code in single post page to get the related posts of the custom posts type.","og_url":"https:\/\/www.codexworld.com\/wordpress-custom-post-type-related-posts\/","og_site_name":"CodexWorld","article_publisher":"https:\/\/www.facebook.com\/codexworld","article_author":"https:\/\/www.facebook.com\/codexworld","article_published_time":"2017-05-23T19:01:25+00:00","og_image":[{"width":1366,"height":768,"url":"https:\/\/www.codexworld.com\/wp-content\/uploads\/2017\/05\/custom-post-type-related-posts-wordpress-codexworld.png","type":"image\/png"}],"author":"CodexWorld","twitter_card":"summary_large_image","twitter_creator":"@codexworldblog","twitter_site":"@codexworldweb","twitter_misc":{"Written by":"CodexWorld","Est. reading time":"3 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.codexworld.com\/wordpress-custom-post-type-related-posts\/#article","isPartOf":{"@id":"https:\/\/www.codexworld.com\/wordpress-custom-post-type-related-posts\/"},"author":{"name":"CodexWorld","@id":"https:\/\/www.codexworld.com\/#\/schema\/person\/9da51d8fa3cdefeb5ec9c69136d4baf0"},"headline":"How to Show Related Posts for Custom Post Type in WordPress","datePublished":"2017-05-23T19:01:25+00:00","mainEntityOfPage":{"@id":"https:\/\/www.codexworld.com\/wordpress-custom-post-type-related-posts\/"},"wordCount":211,"commentCount":7,"publisher":{"@id":"https:\/\/www.codexworld.com\/#organization"},"image":{"@id":"https:\/\/www.codexworld.com\/wordpress-custom-post-type-related-posts\/#primaryimage"},"thumbnailUrl":"https:\/\/www.codexworld.com\/wp-content\/uploads\/2017\/05\/custom-post-type-related-posts-wordpress-codexworld.png","keywords":["WordPress"],"articleSection":["WordPress"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.codexworld.com\/wordpress-custom-post-type-related-posts\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.codexworld.com\/wordpress-custom-post-type-related-posts\/","url":"https:\/\/www.codexworld.com\/wordpress-custom-post-type-related-posts\/","name":"How to Show Related Posts for Custom Post Type in WordPress - CodexWorld","isPartOf":{"@id":"https:\/\/www.codexworld.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.codexworld.com\/wordpress-custom-post-type-related-posts\/#primaryimage"},"image":{"@id":"https:\/\/www.codexworld.com\/wordpress-custom-post-type-related-posts\/#primaryimage"},"thumbnailUrl":"https:\/\/www.codexworld.com\/wp-content\/uploads\/2017\/05\/custom-post-type-related-posts-wordpress-codexworld.png","datePublished":"2017-05-23T19:01:25+00:00","description":"WordPress custom post type related posts - Learn how to show related posts for custom post type in WordPress. Use our code in single post page to get the related posts of the custom posts type.","breadcrumb":{"@id":"https:\/\/www.codexworld.com\/wordpress-custom-post-type-related-posts\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.codexworld.com\/wordpress-custom-post-type-related-posts\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.codexworld.com\/wordpress-custom-post-type-related-posts\/#primaryimage","url":"https:\/\/www.codexworld.com\/wp-content\/uploads\/2017\/05\/custom-post-type-related-posts-wordpress-codexworld.png","contentUrl":"https:\/\/www.codexworld.com\/wp-content\/uploads\/2017\/05\/custom-post-type-related-posts-wordpress-codexworld.png","width":1366,"height":768,"caption":"custom-post-type-related-posts-wordpress-codexworld"},{"@type":"BreadcrumbList","@id":"https:\/\/www.codexworld.com\/wordpress-custom-post-type-related-posts\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.codexworld.com\/"},{"@type":"ListItem","position":2,"name":"How to Show Related Posts for Custom Post Type in WordPress"}]},{"@type":"WebSite","@id":"https:\/\/www.codexworld.com\/#website","url":"https:\/\/www.codexworld.com\/","name":"CodexWorld","description":"Web &amp; Mobile App Development Company","publisher":{"@id":"https:\/\/www.codexworld.com\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.codexworld.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.codexworld.com\/#organization","name":"CodexWorld","url":"https:\/\/www.codexworld.com\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.codexworld.com\/#\/schema\/logo\/image\/","url":"https:\/\/www.codexworld.com\/wp-content\/uploads\/2014\/09\/codexworld-logo.png","contentUrl":"https:\/\/www.codexworld.com\/wp-content\/uploads\/2014\/09\/codexworld-logo.png","width":200,"height":19,"caption":"CodexWorld"},"image":{"@id":"https:\/\/www.codexworld.com\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/codexworld","https:\/\/x.com\/codexworldweb","https:\/\/www.linkedin.com\/company\/codexworld","https:\/\/www.youtube.com\/codexworld"]},{"@type":"Person","@id":"https:\/\/www.codexworld.com\/#\/schema\/person\/9da51d8fa3cdefeb5ec9c69136d4baf0","name":"CodexWorld","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/cf4999db3b409de559f80677afa01729bb2eeda19be273c254e8b2c22729e386?s=96&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/cf4999db3b409de559f80677afa01729bb2eeda19be273c254e8b2c22729e386?s=96&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/cf4999db3b409de559f80677afa01729bb2eeda19be273c254e8b2c22729e386?s=96&r=g","caption":"CodexWorld"},"description":"CodexWorld is a programming blog, one-stop destination for web professionals \u2014 developers, programmers, freelancers, and site owners.","sameAs":["http:\/\/www.codexworld.com","https:\/\/www.facebook.com\/codexworld","https:\/\/x.com\/codexworldblog"],"url":"https:\/\/www.codexworld.com\/author\/nitya192265\/"}]}},"jetpack_publicize_connections":[],"jetpack_featured_media_url":"https:\/\/www.codexworld.com\/wp-content\/uploads\/2017\/05\/custom-post-type-related-posts-wordpress-codexworld.png","jetpack_shortlink":"https:\/\/wp.me\/p6bxIh-DZ","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/www.codexworld.com\/wp-json\/wp\/v2\/posts\/2479","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.codexworld.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.codexworld.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.codexworld.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.codexworld.com\/wp-json\/wp\/v2\/comments?post=2479"}],"version-history":[{"count":1,"href":"https:\/\/www.codexworld.com\/wp-json\/wp\/v2\/posts\/2479\/revisions"}],"predecessor-version":[{"id":2481,"href":"https:\/\/www.codexworld.com\/wp-json\/wp\/v2\/posts\/2479\/revisions\/2481"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.codexworld.com\/wp-json\/wp\/v2\/media\/2480"}],"wp:attachment":[{"href":"https:\/\/www.codexworld.com\/wp-json\/wp\/v2\/media?parent=2479"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.codexworld.com\/wp-json\/wp\/v2\/categories?post=2479"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.codexworld.com\/wp-json\/wp\/v2\/tags?post=2479"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}