WP_Sitemaps_Users::get_users_query_args()protectedWP 5.5.0

Returns the query args for retrieving users to list in the sitemap.

Method of the class: WP_Sitemaps_Users{}

Hooks from the method

Return

Array. Array of WP_User_Query arguments.

Usage

// protected - for code of main (parent) or child class
$result = $this->get_users_query_args();

Changelog

Since 5.5.0 Introduced.

WP_Sitemaps_Users::get_users_query_args() code WP 6.4.3

protected function get_users_query_args() {
	$public_post_types = get_post_types(
		array(
			'public' => true,
		)
	);

	// We're not supporting sitemaps for author pages for attachments and pages.
	unset( $public_post_types['attachment'] );
	unset( $public_post_types['page'] );

	/**
	 * Filters the query arguments for authors with public posts.
	 *
	 * Allows modification of the authors query arguments before querying.
	 *
	 * @see WP_User_Query for a full list of arguments
	 *
	 * @since 5.5.0
	 *
	 * @param array $args Array of WP_User_Query arguments.
	 */
	$args = apply_filters(
		'wp_sitemaps_users_query_args',
		array(
			'has_published_posts' => array_keys( $public_post_types ),
			'number'              => wp_sitemaps_get_max_urls( $this->object_type ),
		)
	);

	return $args;
}