wp_sitemaps_posts_pre_url_list хук-фильтрWP 5.5.0

Filters the posts URL list before it is generated.

Returning a non-null value will effectively short-circuit the generation, returning that value instead.

Использование

add_filter( 'wp_sitemaps_posts_pre_url_list', 'wp_kama_sitemaps_posts_pre_url_list_filter', 10, 3 );

/**
 * Function for `wp_sitemaps_posts_pre_url_list` filter-hook.
 * 
 * @param array[]|null $url_list  The URL list.
 * @param string       $post_type Post type name.
 * @param int          $page_num  Page of results.
 *
 * @return array[]|null
 */
function wp_kama_sitemaps_posts_pre_url_list_filter( $url_list, $post_type, $page_num ){

	// filter...
	return $url_list;
}
$url_list(array[]|null)
The URL list.
По умолчанию: null
$post_type(строка)
Post type name.
$page_num(int)
Page of results.

Список изменений

С версии 5.5.0 Введена.

Где вызывается хук

WP_Sitemaps_Posts::get_url_list()
wp_sitemaps_posts_pre_url_list
wp-includes/sitemaps/providers/class-wp-sitemaps-posts.php 87-92
$url_list = apply_filters(
	'wp_sitemaps_posts_pre_url_list',
	null,
	$post_type,
	$page_num
);

Где используется хук в WordPress

Использование не найдено.