get_userdata() WordPress Function

The get_userdata() function is used to retrieve user information from the database. It takes a user ID or a user object as its only parameter. The function returns an object containing the user's data.

get_userdata( int $user_id ) #

Retrieve user info by user ID.


Parameters

$user_id

(int)(Required)User ID


Top ↑

Return

(WP_User|false) WP_User object on success, false on failure.


Top ↑

Source

File: wp-includes/pluggable.php

	function get_userdata( $user_id ) {
		return get_user_by( 'id', $user_id );
	}


Top ↑

Changelog

Changelog
VersionDescription
0.71Introduced.

The content displayed on this page has been created in part by processing WordPress source code files which are made available under the GPLv2 (or a later version) license by theĀ Free Software Foundation. In addition to this, the content includes user-written examples and information. All material is subject to review and curation by the WPPaste.com community.

Show More