wppaste
WordPress

WP_Sitemaps_Users

Since
5.5.0
Source
wp-includes/sitemaps/providers/class-wp-sitemaps-users.php:17
Users XML sitemap provider.

Hooks fired · 4

Every hook that fires from inside WP_Sitemaps_Users, in the order it appears in the class, grouped by the method that fires it.

Methods · 4

Source

class WP_Sitemaps_Users extends WP_Sitemaps_Provider {	/**	 * WP_Sitemaps_Users constructor.	 *	 * @since 5.5.0	 */	public function __construct() {		$this->name        = 'users';		$this->object_type = 'user';	} 	/**	 * Gets a URL list for a user sitemap.	 *	 * @since 5.5.0	 *	 * @param int    $page_num       Page of results.	 * @param string $object_subtype Optional. Not applicable for Users but	 *                               required for compatibility with the parent	 *                               provider class. Default empty.	 * @return array[] Array of URL information for a sitemap.	 */	public function get_url_list( $page_num, $object_subtype = '' ) {		/**		 * Filters the users URL list before it is generated.		 *		 * Returning a non-null value will effectively short-circuit the generation,		 * returning that value instead.		 *		 * @since 5.5.0		 *		 * @param array[]|null $url_list The URL list. Default null.		 * @param int        $page_num Page of results.		 */		$url_list = apply_filters(			'wp_sitemaps_users_pre_url_list',			null,			$page_num		); 		if ( null !== $url_list ) {			return $url_list;		} 		$args          = $this->get_users_query_args();		$args['paged'] = $page_num; 		$query    = new WP_User_Query( $args );		$users    = $query->get_results();		$url_list = array(); 		foreach ( $users as $user ) {			$sitemap_entry = array(				'loc' => get_author_posts_url( $user->ID ),			); 			/**			 * Filters the sitemap entry for an individual user.			 *			 * @since 5.5.0			 *			 * @param array   $sitemap_entry Sitemap entry for the user.			 * @param WP_User $user          User object.			 */			$sitemap_entry = apply_filters( 'wp_sitemaps_users_entry', $sitemap_entry, $user );			$url_list[]    = $sitemap_entry;		} 		return $url_list;	} 	/**	 * Gets the max number of pages available for the object type.	 *	 * @since 5.5.0	 *	 * @see WP_Sitemaps_Provider::max_num_pages	 *	 * @param string $object_subtype Optional. Not applicable for Users but	 *                               required for compatibility with the parent

History

Introduced in 5.5.0. Unchanged from 6.7.7 through 7.1.0.

  1. 6.7.7
  2. 6.8.8
  3. 6.9.7
  4. 7.0.4
  5. 7.1.0

Signature, return type and hooks compared across 5 parsed releases.

About this page

Parsed data
Generated from the wordpress-develop 6.9.7 tag, from src/wp-includes/sitemaps/providers/class-wp-sitemaps-users.php, and regenerated for each WordPress release so it tracks the code rather than a snapshot of it.
Corrections
Something wrong on this page? Report it and it gets fixed in the next regeneration.