wp_sitemaps_add_provider
Filter HookDescription
Filters the sitemap provider before it is added.Hook Information
File Location |
wp-includes/sitemaps/class-wp-sitemaps-registry.php
View on GitHub
|
Hook Type | Filter |
Line Number | 50 |
Hook Parameters
Type | Name | Description |
---|---|---|
WP_Sitemaps_Provider
|
$provider
|
Instance of a WP_Sitemaps_Provider. |
string
|
$name
|
Name of the sitemap provider. |
Usage Examples
Basic Usage
<?php
// Hook into wp_sitemaps_add_provider
add_filter('wp_sitemaps_add_provider', 'my_custom_filter', 10, 2);
function my_custom_filter($provider, $name) {
// Your custom filtering logic here
return $provider;
}
Source Code Context
wp-includes/sitemaps/class-wp-sitemaps-registry.php:50
- How this hook is used in WordPress core
<?php
45 * @since 5.5.0
46 *
47 * @param WP_Sitemaps_Provider $provider Instance of a WP_Sitemaps_Provider.
48 * @param string $name Name of the sitemap provider.
49 */
50 $provider = apply_filters( 'wp_sitemaps_add_provider', $provider, $name );
51 if ( ! $provider instanceof WP_Sitemaps_Provider ) {
52 return false;
53 }
54
55 $this->providers[ $name ] = $provider;
PHP Documentation
<?php
/**
* 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.
*/
Quick Info
- Hook Type: Filter
- Parameters: 2
- File: wp-includes/sitemaps/class-wp-sitemaps-registry.php
Related Hooks
Related hooks will be displayed here in future updates.