WC_API_Authentication::get_user_by_id() private WC 2.4.0
Get user by ID
{} Это метод класса: WC_API_Authentication{}
Хуков нет.
Возвращает
WP_User.
Использование
// private - только в коде основоного (родительского) класса $result = $this->get_user_by_id( $user_id );
- $user_id(число) (обязательный)
- -
Список изменений
С версии 2.4.0 | Введена. |
Код WC_API_Authentication::get_user_by_id() WC API Authentication::get user by id WC 5.0.0
private function get_user_by_id( $user_id ) {
$user = get_user_by( 'id', $user_id );
if ( ! $user ) {
throw new Exception( __( 'API user is invalid', 'woocommerce' ), 401 );
}
return $user;
}