WP_Sitemaps_Registry::add_provider( string $name, WP_Sitemaps_Provider $provider )
Adds a new sitemap provider.
Parameters
- $name
-
(string) (Required) Name of the sitemap provider.
- $provider
-
(WP_Sitemaps_Provider) (Required) Instance of a WP_Sitemaps_Provider.
Return
(bool) Whether the provider was added successfully.
Source
File: wp-includes/sitemaps/class-wp-sitemaps-registry.php
public function add_provider( $name, WP_Sitemaps_Provider $provider ) { if ( isset( $this->providers[ $name ] ) ) { return false; } /** * Filters the sitemap provider before it is added. * * @since 5.5.0 * * @param WP_Sitemaps_Provider $provider Instance of a WP_Sitemaps_Provider. * @param string $name Name of the sitemap provider. */ $provider = apply_filters( 'wp_sitemaps_add_provider', $provider, $name ); if ( ! $provider instanceof WP_Sitemaps_Provider ) { return false; } $this->providers[ $name ] = $provider; return true; }
Changelog
Version | Description |
---|---|
5.5.0 | Introduced. |
© 2003–2021 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/classes/wp_sitemaps_registry/add_provider