wp_sitemaps_index_entry filter-hookWP 5.5.0

Filters the sitemap entry for the sitemap index.

Usage

add_filter( 'wp_sitemaps_index_entry', 'wp_kama_sitemaps_index_entry_filter', 10, 4 );

/**
 * Function for `wp_sitemaps_index_entry` filter-hook.
 * 
 * @param array  $sitemap_entry  Sitemap entry for the post.
 * @param string $object_type    Object empty name.
 * @param string $object_subtype Object subtype name. Empty string if the object type does not support subtypes.
 * @param int    $page           Page number of results.
 *
 * @return array
 */
function wp_kama_sitemaps_index_entry_filter( $sitemap_entry, $object_type, $object_subtype, $page ){

	// filter...
	return $sitemap_entry;
}
$sitemap_entry(array)
Sitemap entry for the post.
$object_type(string)
Object empty name.
$object_subtype(string)
Object subtype name. Empty string if the object type does not support subtypes.
$page(int)
Page number of results.

Changelog

Since 5.5.0 Introduced.

Where the hook is called

WP_Sitemaps_Provider::get_sitemap_entries()
wp_sitemaps_index_entry
wp-includes/sitemaps/class-wp-sitemaps-provider.php 126
$sitemap_entry = apply_filters( 'wp_sitemaps_index_entry', $sitemap_entry, $this->object_type, $type['name'], $page );

Where the hook is used in WordPress

Usage not found.