WPSEO_Author_Sitemap_Provider::get_users()protectedYoast 1.0

Retrieve users, taking account of all necessary exclusions.

Метод класса: WPSEO_Author_Sitemap_Provider{}

Хуков нет.

Возвращает

Массив.

Использование

// protected - в коде основоного (родительского) или дочернего класса
$result = $this->get_users( $arguments );
$arguments(массив)
Arguments to add.
По умолчанию: []

Код WPSEO_Author_Sitemap_Provider::get_users() Yoast 22.4

protected function get_users( $arguments = [] ) {

	global $wpdb;

	$defaults = [
		'capability' => [ 'edit_posts' ],
		'meta_key'   => '_yoast_wpseo_profile_updated',
		'orderby'    => 'meta_value_num',
		'order'      => 'DESC',
		'meta_query' => [
			'relation' => 'AND',
			[
				'key'     => $wpdb->get_blog_prefix() . 'user_level',
				'value'   => '0',
				'compare' => '!=',
			],
			[
				'relation' => 'OR',
				[
					'key'     => 'wpseo_noindex_author',
					'value'   => 'on',
					'compare' => '!=',
				],
				[
					'key'     => 'wpseo_noindex_author',
					'compare' => 'NOT EXISTS',
				],
			],
		],
	];

	if ( WPSEO_Options::get( 'noindex-author-noposts-wpseo', true ) ) {
		unset( $defaults['capability'] ); // Otherwise it cancels out next argument.
		$defaults['has_published_posts'] = YoastSEO()->helpers->author_archive->get_author_archive_post_types();
	}

	return get_users( array_merge( $defaults, $arguments ) );
}