Snax Plugin noidex

#38747
  • Resolved Imre
    Rank Math free

    Hello,

    I’ve just installed Snax plugin to create lists. The plugin store the items of a list in Snax items which are I think custom post types. Within the SEO & Title settings, I wanted to set noindex, nofollow etc. for these Snax Items to avoid duplicate content, but nothing happens. By checking the source of the items, I still see index, follow etc. So, I manually on the individual post set noindex for these posts, and the noindex setting works.

    Is there a way to get rid of this problem?

    Setting noindex for all snax items individually is pain in the bu**.

    Thank you!

    Regards,

    Imre

    • This topic was modified 4 years, 7 months ago by Imre.
Viewing 3 replies - 1 through 3 (of 3 total)
  • Hello,

    Thank you for contacting Rank Math today.

    It is possible to add some code to noindex a certain post type from the theme. In this regard, I’ve added the following code snippet to your theme’s functions.php file to noindex the ‘snax_item’ post type:

    /**
     * Snippet to change the robots meta for snax_item post type
     *
     * @param array $robots The meta robots directives.
     */
    add_filter( 'rank_math/frontend/robots', function( $robots ) {
    	if(get_post_type() == 'snax_item'){
    		$robots['index'] = 'noindex';
    		$robots['follow'] = 'nofollow';
    	}
    	return $robots;
    });

    Looking forward to helping you. Thank you.

    ​​​​​​

    Imre
    Rank Math free

    Thank you very much for your excellent and fast support. Plus, I’ve learned something new today. 🙂

    Hello,

    We are super happy that this resolved your issue. If you have any other questions in the future, know that we are here to help you.

    If you don’t mind me asking, could you please leave us a review (if you haven’t already) on https://wordpress.org/support/plugin/seo-by-rank-math/reviews/#new-post about your overall experience with Rank Math? We appreciate your time and patience.

    If you do have another question in the future, please feel free to create a new forum topic, and it will be our pleasure to assist you again.

    Thank you.

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

The ticket ‘Snax Plugin noidex’ is closed to new replies.