wp_sitemaps_posts_query_args filter-hookWP 5.5.0

Filters the query arguments for post type sitemap queries.

Usage

add_filter( 'wp_sitemaps_posts_query_args', 'wp_kama_sitemaps_posts_query_args_filter', 10, 2 );

/**
 * Function for `wp_sitemaps_posts_query_args` filter-hook.
 * 
 * @param array  $args      Array of WP_Query arguments.
 * @param string $post_type Post type name.
 *
 * @return array
 */
function wp_kama_sitemaps_posts_query_args_filter( $args, $post_type ){

	// filter...
	return $args;
}
$args(array)
Array of WP_Query arguments.
$post_type(string)
Post type name.

Changelog

Since 5.5.0 Introduced.

Where the hook is called

WP_Sitemaps_Posts::get_posts_query_args()
wp_sitemaps_posts_query_args
wp-includes/sitemaps/providers/class-wp-sitemaps-posts.php 211-224
$args = apply_filters(
	'wp_sitemaps_posts_query_args',
	array(
		'orderby'                => 'ID',
		'order'                  => 'ASC',
		'post_type'              => $post_type,
		'posts_per_page'         => wp_sitemaps_get_max_urls( $this->object_type ),
		'post_status'            => array( 'publish' ),
		'no_found_rows'          => true,
		'update_post_term_cache' => false,
		'update_post_meta_cache' => false,
	),
	$post_type
);

Where the hook is used in WordPress

Usage not found.