Summery Summery
Get the user, if the ID is valid.
Syntax Syntax
Parameters Parameters
- $id
-
(Required) Supplied ID.
Return Return
Source Source
File: wp-includes/rest-api/endpoints/class-wp-rest-users-controller.php
protected function get_user( $id ) { $error = new WP_Error( 'rest_user_invalid_id', __( 'Invalid user ID.' ), array( 'status' => 404 ) ); if ( (int) $id <= 0 ) { return $error; } $user = get_userdata( (int) $id ); if ( empty( $user ) || ! $user->exists() ) { return $error; } if ( is_multisite() && ! is_user_member_of_blog( $user->ID ) ) { return $error; } return $user; }
Advertisement
Changelog Changelog
Version | Description |
---|---|
4.7.2 | Introduced. |