Class: WP_Users_List_Table

Extends WP_List_Table

Core class used to implement displaying users in a list table.


Properties

Name Type(s) Default Value Summary
site_id integer Site ID to generate the Users list table for.
is_site_users boolean Whether or not the current Users list table is for Multisite.
items array Inherited ⋅ The current list of items.
_args array Inherited ⋅ Various information about the current table.
_pagination_args array Inherited ⋅ Various information needed for displaying the pagination.
screen object Inherited ⋅ The current screen.
_actions array Inherited ⋅ Cached bulk actions.
_pagination string Inherited ⋅ Cached pagination output.
modes array Inherited ⋅ The view switcher modes.
_column_headers array Inherited ⋅ Stores the value returned by ->get_column_info().
compat_fields array Inherited ⋅ {@internal Missing Summary}
compat_methods array Inherited ⋅ {@internal Missing Summary}

Methods

WP_Users_List_Table:: __call( callable $name, array $arguments )

Make private/protected methods readable for backward compatibility. Since 4.0.0.

Arguments

Name Type(s) Default Value Description
$name callable

Method to call.

$arguments array

Arguments to pass when calling.

Returns

mixed | boolean

Return value of the callback, false otherwise.


WP_Users_List_Table:: __construct( array | string $args = array() )

Constructor. Since 3.1.0.

The child class should call this constructor from its own constructor to override the default $args.

Arguments

Name Type(s) Default Value Description
$args array | string

{ Array or string of arguments.

@type string $plural   Plural value used for labels and the objects being listed.
                       This affects things such as CSS class-names and nonces used
                       in the list table, e.g. 'posts'. Default empty.
@type string $singular Singular label for an object being listed, e.g. 'post'.
                       Default empty
@type bool   $ajax     Whether the list table supports Ajax. This includes loading
                       and sorting data, for example. If true, the class will call
                       the _js_vars() method in the footer to provide variables
                       to any scripts handling Ajax events. Default false.
@type string $screen   String containing the hook name used to determine the current
                       screen. If left null, the current screen will be automatically set.
                       Default null.

}


WP_Users_List_Table:: __get( string $name )

Make private properties readable for backward compatibility. Since 4.0.0.

Arguments

Name Type(s) Default Value Description
$name string

Property to get.

Returns

mixed

Property.


WP_Users_List_Table:: __isset( string $name )

Make private properties checkable for backward compatibility. Since 4.0.0.

Arguments

Name Type(s) Default Value Description
$name string

Property to check if set.

Returns

boolean

Whether the property is set.


WP_Users_List_Table:: __set( string $name, mixed $value )

Make private properties settable for backward compatibility. Since 4.0.0.

Arguments

Name Type(s) Default Value Description
$name string

Property to check if set.

$value mixed

Property value.

Returns

mixed

Newly-set property.


WP_Users_List_Table:: __unset( string $name )

Make private properties un-settable for backward compatibility. Since 4.0.0.

Arguments

Name Type(s) Default Value Description
$name string

Property to unset.


WP_Users_List_Table:: _js_vars( )

Send required variables to JavaScript land


WP_Users_List_Table:: ajax_response( )

Handle an incoming ajax request (called from admin-ajax.php) Since 3.1.0.


WP_Users_List_Table:: ajax_user_can( )

Checks the current user's permissions Since 3.1.0.


WP_Users_List_Table:: bulk_actions( string $which = '' )

Display the bulk actions dropdown. Since 3.1.0.

Arguments

Name Type(s) Default Value Description
$which string

The location of the bulk actions: 'top' or 'bottom'. This is designated as optional for backward compatibility.


WP_Users_List_Table:: column_cb( object $item )

Arguments

Name Type(s) Default Value Description
$item object

WP_Users_List_Table:: column_default( object $item, string $column_name )

Arguments

Name Type(s) Default Value Description
$item object
$column_name string

WP_Users_List_Table:: comments_bubble( integer $post_id, integer $pending_comments )

Display a comment count bubble Since 3.1.0.

Arguments

Name Type(s) Default Value Description
$post_id integer

The post ID.

$pending_comments integer

Number of pending comments.


WP_Users_List_Table:: current_action( )

Get the current action selected from the bulk actions dropdown. Since 3.1.0.

Returns

string | false

The action name or False if no action was selected


WP_Users_List_Table:: display( )

Display the table Since 3.1.0.


WP_Users_List_Table:: display_rows( )

Generate the table rows Since 3.1.0.


WP_Users_List_Table:: display_rows_or_placeholder( )

Generate the tbody element for the list table. Since 3.1.0.


WP_Users_List_Table:: display_tablenav( string $which )

Generate the table navigation above or below the table Since 3.1.0.

Arguments

Name Type(s) Default Value Description
$which string

WP_Users_List_Table:: extra_tablenav( string $which )

Extra controls to be displayed between bulk actions and pagination Since 3.1.0.

Arguments

Name Type(s) Default Value Description
$which string

WP_Users_List_Table:: get_bulk_actions( )

Get an associative array ( option_name => option_title ) with the list of bulk actions available on this table. Since 3.1.0.

Returns

array


WP_Users_List_Table:: get_column_count( )

Return number of visible columns Since 3.1.0.

Returns

integer


WP_Users_List_Table:: get_column_info( )

Get a list of all, hidden and sortable columns, with filter applied Since 3.1.0.

Returns

array


WP_Users_List_Table:: get_columns( )

Get a list of columns. The format is: 'internal-name' => 'Title' Since 3.1.0.

Returns

array


WP_Users_List_Table:: get_default_primary_column_name( )

Gets the name of the default primary column. Since 4.3.0.

Returns

string

Name of the default primary column, in this case, an empty string.


WP_Users_List_Table:: get_items_per_page( string $option, integer $default = 20 )

Get number of items to display on a single page Since 3.1.0.

Arguments

Name Type(s) Default Value Description
$option string
$default integer

Returns

integer


WP_Users_List_Table:: get_pagenum( )

Get the current page number Since 3.1.0.

Returns

integer


WP_Users_List_Table:: get_pagination_arg( string $key )

Access the pagination args. Since 3.1.0.

Arguments

Name Type(s) Default Value Description
$key string

Pagination argument to retrieve. Common values include 'total_items', 'total_pages', 'per_page', or 'infinite_scroll'.

Returns

integer

Number of items that correspond to the given pagination argument.


WP_Users_List_Table:: get_primary_column( )

Public wrapper for WP_List_Table::get_default_primary_column_name(). Since 4.4.0.

Returns

string

Name of the default primary column.


WP_Users_List_Table:: get_primary_column_name( )

Gets the name of the primary column. Since 4.3.0.

Returns

string

The name of the primary column.


WP_Users_List_Table:: get_role_list( WP_User $user_object )

Returns an array of user roles for a given user object. Since 4.4.0.

Arguments

Name Type(s) Default Value Description
$user_object WP_User

The WP_User object.

Returns

array

An array of user roles.


WP_Users_List_Table:: get_sortable_columns( )

Get a list of sortable columns. The format is: 'internal-name' => 'orderby' or 'internal-name' => array( 'orderby', true ) Since 3.1.0.

The second format will make the initial sorting order be descending

Returns

array


WP_Users_List_Table:: get_table_classes( )

Get a list of CSS classes for the WP_List_Table table tag. Since 3.1.0.

Returns

array

List of CSS classes for the table tag.


WP_Users_List_Table:: get_views( )

Get an associative array ( id => link ) with the list of views available on this table. Since 3.1.0.

Returns

array


WP_Users_List_Table:: handle_row_actions( object $item, string $column_name, string $primary )

Generates and display row actions links for the list table. Since 4.3.0.

Arguments

Name Type(s) Default Value Description
$item object

The item being acted upon.

$column_name string

Current column name.

$primary string

Primary column name.

Returns

string

The row actions HTML, or an empty string if the current column is the primary column.


WP_Users_List_Table:: has_items( )

Whether the table has items to display or not Since 3.1.0.

Returns

boolean


WP_Users_List_Table:: months_dropdown( string $post_type )

Display a monthly dropdown for filtering items Since 3.1.0.

Arguments

Name Type(s) Default Value Description
$post_type string

WP_Users_List_Table:: no_items( )

Message to be displayed when there are no items Since 3.1.0.


WP_Users_List_Table:: pagination( string $which )

Display the pagination. Since 3.1.0.

Arguments

Name Type(s) Default Value Description
$which string

WP_Users_List_Table:: prepare_items( )

Prepares the list of items for displaying. Since 3.1.0.


WP_Users_List_Table:: print_column_headers( boolean $with_id = true )

Print column headers, accounting for hidden and sortable columns. Since 3.1.0.

Arguments

Name Type(s) Default Value Description
$with_id boolean

Whether to set the id attribute or not


WP_Users_List_Table:: row_actions( array $actions, boolean $always_visible = false )

Generate row actions div Since 3.1.0.

Arguments

Name Type(s) Default Value Description
$actions array

The list of actions

$always_visible boolean

Whether the actions should be always visible

Returns

string


Displays the search box. Since 3.1.0.

Arguments

Name Type(s) Default Value Description
$text string

The 'submit' button label.

$input_id string

ID attribute value for the search input field.


WP_Users_List_Table:: set_pagination_args( array | string $args )

An internal method that sets all the necessary pagination arguments Since 3.1.0.

Arguments

Name Type(s) Default Value Description
$args array | string

Array or string of arguments with information about the pagination.


WP_Users_List_Table:: single_row( object $item )

Generates content for a single row of the table Since 3.1.0.

Arguments

Name Type(s) Default Value Description
$item object

The current item


WP_Users_List_Table:: single_row_columns( object $item )

Generates the columns for a single row of the table Since 3.1.0.

Arguments

Name Type(s) Default Value Description
$item object

The current item


WP_Users_List_Table:: view_switcher( string $current_mode )

Display a view switcher Since 3.1.0.

Arguments

Name Type(s) Default Value Description
$current_mode string

WP_Users_List_Table:: views( )

Display the list of views available on this table. Since 3.1.0.


WordPress Developer Newsletter

Stay on top of the latest WordPress API changes, developer tool updates, security alerts and more.