A Select Users field can be inserted in:

  • an Admin Page, as an option or a user_meta
  • a User Profile, as a user_meta
  • a Metabox, as a post_meta
Sukellos Admin Builder

The code below is used to generate this section in an Admin Page, for an option:

Copy to Clipboard

A Select Users inherit from a Field, and an Item, then all settings described in Field Settings and Item Settings are also used.

Specific settings for Select Users:

Select Users Settings Description
role
string | array / Default: ”
An array or a comma-separated list of role names that users must match to be included in results.
Note that this is an inclusive list: users must match *each* role. Default empty.
role__in
array / Default: array()
An array of role names.
Matched users must have at least one of these roles.
Default empty array.
role__not_in
array / Default: array()
An array of role names to exclude.
Users matching one or more of these roles will not be included in results.
Default empty array.
include
array / Default: array()
List of users to be included.
exclude
array / Default: array()
List of users to be excluded.
search
string / Default: ”
Searches for possible string matches on columns.
Use of the * wildcard before and/or after the string will match on columns starting with*, *ending with, or *containing* the string you enter.
search_columns
array / Default: array()
List of database table columns to matches the search string across multiple columns.
One of
‘ID‘ – Search by user id.
‘user_login‘ – Search by user login.
‘user_nicename‘ – Search by user nicename.
‘user_email‘ – Search by user email.
‘user_url‘ – Search by user url.
number
int / Default: 0
The maximum returned number of results.
Leave 0 for all
orderby
string | array / Default: ‘login’
Sort retrieved users by parameter.
Defaults to ‘login’.
It can be a string with a single field, a string containing a list of values separated by commas or spaces, or an array with fields.
order
string / Default: ‘ASC’
Designates the ascending or descending order of the ‘orderby‘ parameter.
Defaults to ‘ASC’.
‘ASC‘ – ascending order from lowest to highest values (1, 2, 3; a, b, c).
‘DESC‘ – descending order from highest to lowest values (3, 2, 1; c, b, a).