WordPress at Your Fingertips
function is not described

WC_API_Authentication::get_user_by_id() private WC 2.4.0

Get user by ID

{} It's a method of the class: WC_API_Authentication{}

No Hooks.

Return

WP_User.

Usage

// private - for code of main (parent) class only
$result = $this->get_user_by_id( $user_id );
$user_id(int) (required)
-

Changelog

Since 2.4.0 Introduced.

Code of WC_API_Authentication::get_user_by_id() WC 5.6.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;
}