WordPress как на ладони
Недорогой хостинг для сайтов на WordPress: wordpress.jino.ru
функция не описана

WP_Users_List_Table::prepare_items() public WP 3.1.0

Prepare the users list for display.

Это метод класса: WP_Users_List_Table{}

Хуки из метода
Возвращает

Null. Ничего.

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

$WP_Users_List_Table = new WP_Users_List_Table();
$WP_Users_List_Table->prepare_items();

Заметки

  • Global. Строка. $role
  • Global. Строка. $usersearch

Список изменений

С версии 3.1.0 Введена.

Код WP_Users_List_Table::prepare_items() WP 5.5.1

wp-admin/includes/class-wp-users-list-table.php
<?php
public function prepare_items() {
	global $role, $usersearch;

	$usersearch = isset( $_REQUEST['s'] ) ? wp_unslash( trim( $_REQUEST['s'] ) ) : '';

	$role = isset( $_REQUEST['role'] ) ? $_REQUEST['role'] : '';

	$per_page       = ( $this->is_site_users ) ? 'site_users_network_per_page' : 'users_per_page';
	$users_per_page = $this->get_items_per_page( $per_page );

	$paged = $this->get_pagenum();

	if ( 'none' === $role ) {
		$args = array(
			'number'  => $users_per_page,
			'offset'  => ( $paged - 1 ) * $users_per_page,
			'include' => wp_get_users_with_no_role( $this->site_id ),
			'search'  => $usersearch,
			'fields'  => 'all_with_meta',
		);
	} else {
		$args = array(
			'number' => $users_per_page,
			'offset' => ( $paged - 1 ) * $users_per_page,
			'role'   => $role,
			'search' => $usersearch,
			'fields' => 'all_with_meta',
		);
	}

	if ( '' !== $args['search'] ) {
		$args['search'] = '*' . $args['search'] . '*';
	}

	if ( $this->is_site_users ) {
		$args['blog_id'] = $this->site_id;
	}

	if ( isset( $_REQUEST['orderby'] ) ) {
		$args['orderby'] = $_REQUEST['orderby'];
	}

	if ( isset( $_REQUEST['order'] ) ) {
		$args['order'] = $_REQUEST['order'];
	}

	/**
	 * Filters the query arguments used to retrieve users for the current users list table.
	 *
	 * @since 4.4.0
	 *
	 * @param array $args Arguments passed to WP_User_Query to retrieve items for the current
	 *                    users list table.
	 */
	$args = apply_filters( 'users_list_table_query_args', $args );

	// Query the user IDs for this page.
	$wp_user_search = new WP_User_Query( $args );

	$this->items = $wp_user_search->get_results();

	$this->set_pagination_args(
		array(
			'total_items' => $wp_user_search->get_total(),
			'per_page'    => $users_per_page,
		)
	);
}