Filter hook 'wp_sitemaps_posts_query_args'

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

View Source

wp_sitemaps_posts_query_args

Filter Hook
Description
Filters the query arguments for post type sitemap queries.

Hook Information

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

Hook Parameters

Type Name Description
array $args Array of WP_Query arguments.
string $post_type Post type name.

Usage Examples

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

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

Source Code Context

wp-includes/sitemaps/providers/class-wp-sitemaps-posts.php:237 - How this hook is used in WordPress core
<?php
 232  		 * @since 6.1.0 Added `ignore_sticky_posts` default parameter.
 233  		 *
 234  		 * @param array  $args      Array of WP_Query arguments.
 235  		 * @param string $post_type Post type name.
 236  		 */
 237  		$args = apply_filters(
 238  			'wp_sitemaps_posts_query_args',
 239  			array(
 240  				'orderby'                => 'ID',
 241  				'order'                  => 'ASC',
 242  				'post_type'              => $post_type,

PHP Documentation

<?php
/**
		 * Filters the query arguments for post type sitemap queries.
		 *
		 * @see WP_Query for a full list of arguments.
		 *
		 * @since 5.5.0
		 * @since 6.1.0 Added `ignore_sticky_posts` default parameter.
		 *
		 * @param array  $args      Array of WP_Query arguments.
		 * @param string $post_type Post type name.
		 */
Quick Info
  • Hook Type: Filter
  • Parameters: 2
  • File: wp-includes/sitemaps/providers/class-wp-sitemaps-posts.php
Related Hooks

Related hooks will be displayed here in future updates.