WP_Sitemaps_Users::get_users_query_args() WordPress Method

The WP_Sitemaps_Users::get_users_query_args() method is used to get the query arguments for a list of users. This is useful for sitemaps that need to list all the users on a site.

WP_Sitemaps_Users::get_users_query_args() #

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


Return

(array) Array of WP_User_Query arguments.


Top ↑

Source

File: wp-includes/sitemaps/providers/class-wp-sitemaps-users.php

	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.
		unset( $public_post_types['attachment'] );

		/**
		 * 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;
	}


Top ↑

Changelog

Changelog
VersionDescription
5.5.0Introduced.

The content displayed on this page has been created in part by processing WordPress source code files which are made available under the GPLv2 (or a later version) license by theĀ Free Software Foundation. In addition to this, the content includes user-written examples and information. All material is subject to review and curation by the WPPaste.com community.