wp_sitemaps_posts_entry filter-hookWP 5.5.0

Filters the sitemap entry for an individual post.

Usage

add_filter( 'wp_sitemaps_posts_entry', 'wp_kama_sitemaps_posts_entry_filter', 10, 3 );

/**
 * Function for `wp_sitemaps_posts_entry` filter-hook.
 * 
 * @param array   $sitemap_entry Sitemap entry for the post.
 * @param WP_Post $post          Post object.
 * @param string  $post_type     Name of the post_type.
 *
 * @return array
 */
function wp_kama_sitemaps_posts_entry_filter( $sitemap_entry, $post, $post_type ){

	// filter...
	return $sitemap_entry;
}
$sitemap_entry(array)
Sitemap entry for the post.
$post(WP_Post)
Post object.
$post_type(string)
Name of the post_type.

Changelog

Since 5.5.0 Introduced.

Where the hook is called

WP_Sitemaps_Posts::get_url_list()
wp_sitemaps_posts_entry
wp-includes/sitemaps/providers/class-wp-sitemaps-posts.php 164
$sitemap_entry = apply_filters( 'wp_sitemaps_posts_entry', $sitemap_entry, $post, $post_type );

Where the hook is used in WordPress

Usage not found.