Support » Plugin: Yet Another Related Posts Plugin (YARPP) » Where do I get started with Related Posts for a CPT

Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Author jeffparker


    Please see the “Other Notes” subhead in this section:

    Once you take a look there, I may be able to help if you’re still having trouble.



    Have you seen that page? It talks about some function which you can use but has no working examples and gives little clue as to were to get started.

    Here is what I have and I keep getting “No related posts.”

    I have a custom post type of movies. With a Custom Taxonomies of movie-genre which I would like to get related results based on.

    Here is the code I am trying to use:

    		'post_type' => array('movies'),
    		'show_pass_post' => false,
    		'past_only' => false,
    		'recent' => false,
    		'weight' => array(
    			'body' => 1,
    			'title' => 2,
    			'tax' => array(
    				'movie-genre' => 1
    		'require_tax' => array(
    			'movie-genre' => 1
    		'threshold' => 5,
    		'template' => false,
    		'limit' => 5,
    		'order' => 'score DESC'

    If you could explain how I am using this wrong or why its returning “No related posts”. I would appreciate it very much.


    I think that you need to add the yarrp_support parameter when you register your CPT.

    Like this:

    add_action( 'init', 'create_post_type' );
    function create_post_type() {
    	register_post_type( 'acme_product',
    			'labels' => array(
    				'name' => __( 'Products' ),
    				'singular_name' => __( 'Product' )
    		'public' => true,
    		'has_archive' => true,
                    'yarpp_support' => true

    If you’ve created the CPT with a plugin, you may have to remove it and add it via functions.php. If you’re using Custom Post Type UI I think you can export your post type to a function then add the yarpp_support parameter.

    Note: I haven’t tested this and have no idea if it will work or not.

    Where did you get that info from? Is there supporting documentation?

    I had already defined my CPT in my functions.php file so I just added the following line into my CPT array:

    'yarpp_support' => true

    The results were “No related posts.”

    PS. If you have no idea how are you sharing an idea? Dont discredit yourself. It makes your information seem unworthy and almost had me not even bother trying it.

    @chaleybgis – Thank You!

    After I updated the part you mentioned. I sought out where in the plugin was something like this required. I found that the class-core.php has a filter function called post_type_filter(). Which validated the current post type for having yarpp_support. Thank you for that tid bit of MOST USEFUL information.

    Once I found this piece of code was required and I noticed the widget started working. I then realized I had some errors in my yarpp_related() function call.

    <strong>be sure to add</strong>
    'yarpp_support' => true //place this in your register post type function

    Thanks Again,

    Actually that documentation was the first line on the link that jeffparker provided

    Custom post types

    To make YARPP support your custom post type, the attribute yarpp_support must be set to true on the custom post type when it is registered. It will then be available on options on the YARPP settings page.

    Plugin Author jeffparker


    Thanks, chaleybgis, for your help explaining!

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Where do I get started with Related Posts for a CPT’ is closed to new replies.