Viewing 2 replies - 1 through 2 (of 2 total)
  • I looked around but couldn’t find a plugin that can configure the native XML sitemaps functionality to such a level of granularity. The best I could find was WP Sitemaps Config which can disable ALL of specific sitemaps like all users, all categories, all tags, etc… but not individual tags, or categories.

    So you’ll very likely need to do this via custom code.

    The feature announcement has code snippets to unset the sitemap for specific cases: https://make.wordpress.org/core/2020/07/22/new-xml-sitemaps-functionality-in-wordpress-5-5/

    And perhaps more to the point with code snippets for various cases: https://perishablepress.com/customize-wordpress-sitemaps/

    Another option is to use an SEO plugin (if you’re not using one already) or a 3rd-party XML sitemaps plugin… as these override WordPress’ built-in sitemaps feature, but allow more control over their own XML sitemap feature.

    For instance, the Yoast SEO plugin can disable Google listing for all or individual categories, tags, etc. Once you configure the option for an archive type, it is also removed from the XML sitemap index, since there’s no point submitting an XML sitemap for a page you don’t want appearing in search results.

    Good luck!

    Hello @nexgraphics

    You can use this code snippets

    add_filter(
        'wp_sitemaps_taxonomies',
        function( $taxonomies ) {
    	unset( $taxonomies['category'] );		
            unset( $taxonomies['post_tag'] );
            return $taxonomies;
        }
    );
    
    add_filter(
        'wp_sitemaps_add_provider',
        function( $provider, $name ) {
            if ( 'users' === $name ) {
                return false;
            }
            return $provider;
        },
        10,
        2
    );

    hope this helps

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘wp-sitemap.xml – how to remove’ is closed to new replies.