How to add Custom Post Type to RankMath

#745257
  • Resolved Roger Baker
    Rank Math free

    I am trying to find documentation on how to add a custom post type to RankMath that has not been detected by the plugin. I have a custom post type that is part of my theme, but is not showing in the Titles & Meta settings under Post Types.

    Is there a way I can have RankMath detect this as a custom post type?

Viewing 13 replies - 1 through 13 (of 13 total)
  • Hello,

    I apologize for the inconvenience you are facing with Rank Math. If Rank Math does not detect a custom post type automatically, you can manually add it to the Titles & Meta settings under Post Types.

    To do this, you need to follow these steps:

    1. Go to the Titles & Meta page in Rank Math.
    2. Click on the Titles & Meta page option in the notification that appears when a new post type is detected.
    3. In the Titles & Meta settings, you can configure the SEO settings for the newly created post type.

    If your custom post type is not automatically detected by Rank Math, you can manually configure the SEO settings by following the steps mentioned above.

    If you need further assistance or detailed guidance, please let us know by replying to this ticket. Our support team will be happy to help you.

    Thank you for reaching out with your concern.

    Sources:
    We Detected New Post Type(s) » Rank Math
    Why Isn’t Rank Math Detecting the Table of Contents? » Rank Math
    Enable Rank Math SEO on Elementor Templates » Rank Math
    General Tab in Meta Box of Rank Math SEO Plugin
    Fix Excluded by NoIndex Tag – Google Search Console Status » Rank Math

    Hello,

    Thank you for contacting us and sorry for any inconvenience that might have been caused due to that.

    Please make sure the CPT from your theme is publicly visible or publicly queryable.

    Alternatively, you can add the following filter to your website to force this CPT to be parsed by our plugin:

    add_filter( 'rank_math/excluded_post_types',function( $post_types) {
          $post_types['your_post_type'] = 'your_post_type';
         return $post_types;
    }, 11 );
    

    Make sure to change your_post_type with the actual post type on your site.

    Here’s how you can add filter/hook to your WordPress site:
    https://rankmath.com/kb/wordpress-hooks-actions-filters/

    Let us know how it goes. Looking forward to helping you.

    Thank you.

    Hi Rakibuzzaman,

    Thank you for the reply, this worked. One last little detail I would like to fix, if possible, is to title of the post type to the settings sidebar on the Titles and Meta page:

    https://imgur.com/a/81APSkU

    If we could also get that added, that would be great! Thank you for your help so far!

    Hello,

    Could you please share the exact filter you have added so we can check? The post type name should be shown in that section.

    Meanwhile, clear your browser’s cache and transients on your WordPress dashboard > Rank Math > Status & Tools > Database Tools

    trans

    Looking forward to helping you.

    Hi,

    I tried the methods mentioned and still do not see the title. There is also a second custom post type I added but I do not see a second tab for that post type specifically, still just the 1 tab with a blank title.

    Here is a screenshot of the code I added to my functions.php file:

    https://imgur.com/a/8DKurmC

    Let me know if you have any questions or suggestions, thank you!

    Hello,

    Please check how your theme is registering the post type.

    Here’s an example of how you should register a post type with the CPT name:

    add_action('init', function(){
    
    	register_post_type(
    		'movies',
    		// CPT Options
    		array(
    			'labels' => array(
    				'name' => __('Movies'),
    				'singular_name' => __('Movie')
    			),
    			'public' => true,
    			'has_archive' => false,
    			'rewrite' => array('slug' => 'movies'),
    		)
    	);
    
    });

    Rank Math will take the name/title of the CPT from this line: 'name' => __('Movies'),

    Hope that helps and please do not hesitate to let us know if you need my assistance with anything else.

    Hi Jeremy,

    Thank you for the info. I went to confirm that there is a name key value pair, and I did find that the custom post type is registered with one, see image:

    https://imgur.com/a/81iw5fW

    Are there any other ways I could possibly get RankMath to recognize this?

    Let me know, thank you!

    Hello,

    We might need to take a closer look at the settings. Please edit the first post on this ticket and include your WordPress & FTP logins in the designated Sensitive Data section.

    Please do take a complete backup of your website before sharing the information with us.

    Sensitive Data Section

    It is completely secure and only our support staff has access to that section. If you want, you can use the below plugin to generate a temporary login URL to your website and share that with us instead:

    https://wordpress.org/plugins/temporary-login-without-password/

    You can use the above plugin in conjunction with the WP Security Audit Log to monitor what changes our staff might make on your website (if any):

    https://wordpress.org/plugins/wp-security-audit-log/

    We really look forward to helping you.

    Hello,

    I have updated the sensitive data as requested. Can you please check further?

    Thank you.

    Hello,

    Looks like you have shared the login details but did not incluse the site admin login url.

    Could you please add the website;s admin login url as well so that we can use the credentials there to login and check.

    We really look forward to helping you.

    Thank you.

    Hello,

    I have updated the sensitive data as requested. Can you please check further?

    Thank you.

    Hello Alhan,

    I have added the login URL!

    Let me know if there is anything else, thank you!

    Hello,

    You will need to call the function to create the post types earlier than wp_loaded.

    Our functions to create the accessible post types rely on it and it causes issues with adding the correct data into the plugin.

    You could call that function in init which should resolve the issue.

    Don’t hesitate to get in touch if you have any other qeustions.

    Hello,

    Since we did not hear back from you for 15 days, we are assuming that you found the solution. We are closing this support ticket.

    If you still need assistance or any other help, please feel free to open a new support ticket, and we will be more than happy to assist.

    Thank you.

Viewing 13 replies - 1 through 13 (of 13 total)

The ticket ‘How to add Custom Post Type to RankMath’ is closed to new replies.