Support » Plugin: The SEO Framework » Filter for setting index and follow options on category

  • Resolved boybawang


    Is there a filter that will let me specify the index/noindex and follow/nofollow settings for specific categories?

    I realize this can be specified within the plugin settings for post types, but I’d like some posts within the custom post types to have different settings than the default. I realize I can manually override this, but I’d like do have this done automatically.


    • This topic was modified 1 month, 3 weeks ago by boybawang.
Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Sybre Waaijer


    Hi Pete,

    Please see

    Note that TSF does not support index/follow, for they are implied when noindex/nofollow aren’t provided. So, if you want to unset a noindex/nofollow, aptly, you’ll have to unset() them.

    Thread Starter boybawang


    Thank you, @cybr. How can I modify that example so that it unsets noindex/nofollow only in the case of a specific category?

    Plugin Author Sybre Waaijer



    I added the unset example for category in the snippet below.

    add_filter( 'the_seo_framework_robots_meta_array', function( $meta, $args, $ignore ) {
    	$taxonomy = null === $args
    		? the_seo_framework()->get_current_taxonomy()
    		: ( isset( $args['taxonomy'] ) ? $args['taxonomy'] : '' );
    	if ( 'post_tag' === $taxonomy ) {
    		$meta['noindex'] = 'noindex';
    		$meta['nofollow'] = 'nofollow';
    	if ( 'category' === $taxonomy ) {
    		// Not recommended! This overrides some of TSF's protection.
    		unset( $meta['noindex'], $meta['nofollow'] );
    	return $meta;
    }, 10, 3 );

    Alas, you cannot test why TSF enabled noindex from its generation value. Doing so yourself would look a bit like this

    Nevertheless, I hope this helps 🙂 Cheers!

    Thread Starter boybawang


    Great, thank you so much!

Viewing 4 replies - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.