Filter hook 'wp_sitemaps_posts_pre_url_list'

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

View Source

wp_sitemaps_posts_pre_url_list

Filter Hook
Description
Filters the posts URL list before it is generated. Returning a non-null value will effectively short-circuit the generation, returning that value instead.

Hook Information

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

Hook Parameters

Type Name Description
array[]|null $url_list The URL list. Default null.
string $post_type Post type name.
int $page_num Page of results.

Usage Examples

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

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

Source Code Context

wp-includes/sitemaps/providers/class-wp-sitemaps-posts.php:87 - How this hook is used in WordPress core
<?php
  82  		 *
  83  		 * @param array[]|null $url_list  The URL list. Default null.
  84  		 * @param string       $post_type Post type name.
  85  		 * @param int          $page_num  Page of results.
  86  		 */
  87  		$url_list = apply_filters(
  88  			'wp_sitemaps_posts_pre_url_list',
  89  			null,
  90  			$post_type,
  91  			$page_num
  92  		);

PHP Documentation

<?php
/**
		 * Filters the posts URL list before it is generated.
		 *
		 * Returning a non-null value will effectively short-circuit the generation,
		 * returning that value instead.
		 *
		 * @since 5.5.0
		 *
		 * @param array[]|null $url_list  The URL list. Default null.
		 * @param string       $post_type Post type name.
		 * @param int          $page_num  Page of results.
		 */
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.