apply_filters( ‘wp_sitemaps_add_provider’, WP_Sitemaps_Provider $provider, string $name )

Filters the sitemap provider before it is added.

Parameters

$providerWP_Sitemaps_Provider
Instance of a WP_Sitemaps_Provider.
$namestring
Name of the sitemap provider.

Source

$provider = apply_filters( 'wp_sitemaps_add_provider', $provider, $name );

Changelog

VersionDescription
5.5.0Introduced.

User Contributed Notes

  1. Skip to note 2 content
    // wp-sitemaps users disable
    add_filter( 'wp_sitemaps_add_provider', function ( $provider, $name ) {
        if ( 'users' === $name ) {
            return false;
        }
    
        return $provider;
    }, 10, 2 );
    
    add_filter( 'wp_sitemaps_register_providers', function ( $providers ) {
        unset( $providers['users'] );
        return $providers;
    } );
    
    // wp-sitemaps tags disable
    add_filter( 'wp_sitemaps_taxonomies', function ( $taxonomies ) {
        unset( $taxonomies['post_tag'] );
        return $taxonomies;
    } );

You must log in before being able to contribute a note or feedback.