• I’d suggest you also hide the users page from the sitemap.

    add_filter( 'wp_sitemaps_add_provider', function(  $provider, $name ) {
    	if ( $name === 'users' )
    		return NULL;
    	return $provider;
    }, 10, 2 );
Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Author freemp

    (@freemp)

    Good point, thanks!

    What about adding this as well …. ?

    add_filter( 'wp_sitemaps_register_providers',
    	function( $providers ) {
    		unset( $providers['users'] );
    		return $providers;
    	} );
    Thread Starter Konstantinos Raktivan

    (@constracti)

    I can’t find the hook wp_sitemaps_register_providers in the documentation.

    Plugin Author freemp

    (@freemp)

    Hmm… true, actually. I mentioned it because it appears here:

    https://developer.wordpress.org/reference/hooks/wp_sitemaps_add_provider/#user-contributed-notes

    Plugin Author freemp

    (@freemp)

    I was just creating a test site with a test user on wordpress.com just to see its sitemap. From what I see, there are no users listed. Could it be that the users provider is disabled by default?

    Thread Starter Konstantinos Raktivan

    (@constracti)

    Make sure Discourage search engines from indexing this site is not set from Settings :: Reading :: Search engine visibility. Then by default a sitemap is rendered at /wp-sitemap.xml, listing the users provider. Enabling your plugin does not hide this entry. I just checked in a brand new site with the preinstalled theme and no other plugins.

    We want the sitemap, but I claim that the users provider is not relevant when your plugin is activated.

    Plugin Author freemp

    (@freemp)

    I was setting up a new local test site and was able to reproduce what you described above.

    I also agree that the users section should not be rendered with the plugin activated. So I will soon publish a new version of the plugin with your suggestion included.

    Thanks again for reporting!

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘remove users from sitemap’ is closed to new replies.