Disable woocommerce product attribute indexing

#286515
  • Resolved Favculture Digital
    Rank Math free

    Hello support,
    The long product attribute titles & meta setting appearing on my website (https://ibb.co/Lv25t0f) which are not required.
    Also these attributes were indexed by Google (https://ibb.co/J3T6qsq) which are also not required for my website.
    Please suggest how to disable these attribute settings and prevent search engines from indexing them.

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

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

    Please use the filter given below in your theme’s functions.php file to remove the product attributes from the titles & meta settings:

    add_filter( 'rank_math/settings/title', function( $titles ) {
    	$titles = array_filter( $titles, function( $title ) {
    		return ! isset( $title['taxonomy'] ) || strncmp( $title['taxonomy'], 'pa_', 3 ) !== 0;
    	} );
    	return $titles;
    } );

    And before applying the filter, click on the product attributes and enable the Robots Meta option, and set it as noindex:

    Hope this helps. Let us know if you need any other assistance.

    Thank for support. The code removed attributes. But if a new attribute added then it’s may not be possible to set that as noindex. In that case an easy setting required to set noindex for all attributes at once. It will be great if this feature added in future versions.

    Prabhat
    Rank Math agency

    Hello,

    You can easily fix this by not checking the Enable Archives? option while creating the attributes.

    When this option is not checked, the attributes are not added to Titles & Meta settings and the archives are also not created for them. Hence, Google would not index them.

    Hope this helps.

    Thank you.

    Yes, this is the easy way. But I only import affiliate poducts for my site and the attributes will generate automatically. So its better to use global attributes disable setting..

    Hello,

    Yes, if the attributes are being generated automatically then it is better to use the filter to disable them from being included in the titles & meta settings. And since they are not being added in the titles & meta settings, they should be set to noindex.

    Hope this helps. Let us know if you need any other assistance.

    Thanks.

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

You must be logged in to reply to this ticket.