• Hi,
    great plugin, however I see one issue with using this plugin.
    As of WordPress 5.5 core sitemaps will be generated for posts, pages, categories, tags, author archives.

    Disabling certain archive pages with this plugin doesn’t remove them from the core WordPress sitemaps.

    For example even after disabling the category archives using this plugin, they are still accessible from the sitemap, located on /sitemap.xml.

    Both search engines and users can access the sitemap, follow the broken links and receive the 404 – not found error, which is not good for SEO and for user experience.

    It is possible to deregister the archive pages from the core sitemaps, there is an API for that.

    I think the plugin should deregister those archive pages from the sitemap which are disabled through the plugin. Then upon enabling certain archive pages again, or upon uninstalling the plugin, the plugin should register them again for the sitemap.

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter Bence

    (@charybdis)

    For example:

    // Remove author archive from the sitemap
    add_filter(
        'wp_sitemaps_add_provider',
        function( $provider, $name ) {
            if ( 'users' === $name ) {
                return false;
            }
     
            return $provider;
        },
        10,
        2
    );
    
    // Remove category archive from the sitemap
    add_filter(
        'wp_sitemaps_taxonomies',
        function( $taxonomies ) {
            unset( $taxonomies['category'] );
            return $taxonomies;
        }
    );

    Great suggestion. +1

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Remove the archive pages from the sitemap’ is closed to new replies.