WordPress at a glance
function is not described

WP_Sitemaps_Registry::add_provider() public WP 5.5.0

Adds a new sitemap provider.

{} It's a method of the class: WP_Sitemaps_Registry{}

Hooks from the method
Return

true/false. Whether the provider was added successfully.

Usage

$WP_Sitemaps_Registry = new WP_Sitemaps_Registry();
$WP_Sitemaps_Registry->add_provider( $name, $provider );
$name(string) (required)
Name of the sitemap provider.
$provider(WP_Sitemaps_Provider) (required)
Instance of a WP_Sitemaps_Provider.

Changelog

Since 5.5.0 Introduced.

Code of WP_Sitemaps_Registry::add_provider() WP 5.5.1

<?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;
}