There is not much documentation out there about adding Jetpack’s Related Posts to your own Custom Post Types, so I thought I’d share how to do it!
function allow_my_post_types($allowed_post_types) { $allowed_post_types[] = 'your-post-type'; return $allowed_post_types; } add_filter( 'rest_api_allowed_post_types', 'allow_my_post_types' );
Once you’ve replaced your-post-type
with your Custom Post Type and added that snippet of code to your themes functions.php
, make sure to Reindex your Posts through Jetpack for the changes to work.
I can see this being really useful if you have Products, a Portfolio, or even Events on your site.
Leave a Reply to Leo GopalCancel reply