WP_REST_Users_Controller::get_item_schema() – Retrieves the user’s schema, conforming to JSON Schema.

You appear to be a bot. Output may be restricted

Description

Retrieves the user's schema, conforming to JSON Schema.

Usage

$array = WP_REST_Users_Controller::get_item_schema();

Parameters

Returns

array Item schema data.

Source

File name: wordpress/wp-includes/rest-api/endpoints/class-wp-rest-users-controller.php
Lines:

1 to 100 of 165
  public function get_item_schema() {
    if ( $this->schema ) {
      return $this->add_additional_fields_schema( $this->schema );
    }

    $schema = array(
      '$schema'    => 'http://json-schema.org/draft-04/schema#',
      'title'      => 'user',
      'type'       => 'object',
      'properties' => array(
        'id'                 => array(
          'description' => __( 'Unique identifier for the user.' ),
          'type'        => 'integer',
          'context'     => array( 'embed', 'view', 'edit' ),
          'readonly'    => true,
        ),
        'username'           => array(
          'description' => __( 'Login name for the user.' ),
          'type'        => 'string',
          'context'     => array( 'edit' ),
          'required'    => true,
          'arg_options' => array(
            'sanitize_callback' => array( $this, 'check_username' ),
          ),
        ),
        'name'               => array(
          'description' => __( 'Display name for the user.' ),
          'type'        => 'string',
          'context'     => array( 'embed', 'view', 'edit' ),
          'arg_options' => array(
            'sanitize_callback' => 'sanitize_text_field',
          ),
        ),
        'first_name'         => array(
          'description' => __( 'First name for the user.' ),
          'type'        => 'string',
          'context'     => array( 'edit' ),
          'arg_options' => array(
            'sanitize_callback' => 'sanitize_text_field',
          ),
        ),
        'last_name'          => array(
          'description' => __( 'Last name for the user.' ),
          'type'        => 'string',
          'context'     => array( 'edit' ),
          'arg_options' => array(
            'sanitize_callback' => 'sanitize_text_field',
          ),
        ),
        'email'              => array(
          'description' => __( 'The email address for the user.' ),
          'type'        => 'string',
          'format'      => 'email',
          'context'     => array( 'edit' ),
          'required'    => true,
        ),
        'url'                => array(
          'description' => __( 'URL of the user.' ),
          'type'        => 'string',
          'format'      => 'uri',
          'context'     => array( 'embed', 'view', 'edit' ),
        ),
        'description'        => array(
          'description' => __( 'Description of the user.' ),
          'type'        => 'string',
          'context'     => array( 'embed', 'view', 'edit' ),
        ),
        'link'               => array(
          'description' => __( 'Author URL of the user.' ),
          'type'        => 'string',
          'format'      => 'uri',
          'context'     => array( 'embed', 'view', 'edit' ),
          'readonly'    => true,
        ),
        'locale'             => array(
          'description' => __( 'Locale for the user.' ),
          'type'        => 'string',
          'enum'        => array_merge( array( '', 'en_US' ), get_available_languages() ),
          'context'     => array( 'edit' ),
        ),
        'nickname'           => array(
          'description' => __( 'The nickname for the user.' ),
          'type'        => 'string',
          'context'     => array( 'edit' ),
          'arg_options' => array(
            'sanitize_callback' => 'sanitize_text_field',
          ),
        ),
        'slug'               => array(
          'description' => __( 'An alphanumeric identifier for the user.' ),
          'type'        => 'string',
          'context'     => array( 'embed', 'view', 'edit' ),
          'arg_options' => array(
            'sanitize_callback' => array( $this, 'sanitize_slug' ),
          ),
        ),
        'registered_date'    => array(
          'description' => __( 'Registration date for the user.' ),
          'type'        => 'string',
          'format'      => 'date-time',
 

 View on GitHub View on Trac