Filter hook 'wp_sitemaps_posts_entry'

in WP Core File wp-includes/sitemaps/providers/class-wp-sitemaps-posts.php at line 164

View Source

wp_sitemaps_posts_entry

Filter Hook
Description
Filters the sitemap entry for an individual post.

Hook Information

File Location wp-includes/sitemaps/providers/class-wp-sitemaps-posts.php View on GitHub
Hook Type Filter
Line Number 164

Hook Parameters

Type Name Description
array $sitemap_entry Sitemap entry for the post.
WP_Post $post Post object.
string $post_type Name of the post_type.

Usage Examples

Basic Usage
<?php
// Hook into wp_sitemaps_posts_entry
add_filter('wp_sitemaps_posts_entry', 'my_custom_filter', 10, 3);

function my_custom_filter($sitemap_entry, $post, $post_type) {
    // Your custom filtering logic here
    return $sitemap_entry;
}

Source Code Context

wp-includes/sitemaps/providers/class-wp-sitemaps-posts.php:164 - How this hook is used in WordPress core
<?php
 159  			 *
 160  			 * @param array   $sitemap_entry Sitemap entry for the post.
 161  			 * @param WP_Post $post          Post object.
 162  			 * @param string  $post_type     Name of the post_type.
 163  			 */
 164  			$sitemap_entry = apply_filters( 'wp_sitemaps_posts_entry', $sitemap_entry, $post, $post_type );
 165  			$url_list[]    = $sitemap_entry;
 166  		}
 167  
 168  		return $url_list;
 169  	}

PHP Documentation

<?php
/**
			 * Filters the sitemap entry for an individual post.
			 *
			 * @since 5.5.0
			 *
			 * @param array   $sitemap_entry Sitemap entry for the post.
			 * @param WP_Post $post          Post object.
			 * @param string  $post_type     Name of the post_type.
			 */
Quick Info
  • Hook Type: Filter
  • Parameters: 3
  • File: wp-includes/sitemaps/providers/class-wp-sitemaps-posts.php
Related Hooks

Related hooks will be displayed here in future updates.