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
Return
(WP_User|false) WP_User object on success, false on failure.
Source
File: wp-includes/pluggable.php
function get_userdata( $user_id ) { return get_user_by( 'id', $user_id ); }
Expand full source codeCollapse full source codeView on TracView on GitHub
Related
Uses
Uses | Description |
---|---|
wp-includes/pluggable.php:get_user_by() | Retrieve user info by a given field |
Used By
Used By | Description |
---|---|
wp-includes/user.php:wp_list_users() | Lists all the users of the site, with several options available. |
wp-includes/rest-api/endpoints/class-wp-rest-templates-controller.php:WP_REST_Templates_Controller::prepare_item_for_database() | Prepares a single template for create or update. |
wp-admin/includes/ajax-actions.php:wp_ajax_send_password_reset() | Ajax handler sends a password reset link. |
wp-includes/ms-functions.php:wpmu_new_site_admin_notification() | Notifies the Multisite network administrator that a new site was created. |
wp-includes/rest-api/endpoints/class-wp-rest-application-passwords-controller.php:WP_REST_Application_Passwords_Controller::get_user() | Gets the requested user. |
wp-includes/user.php:wp_is_application_passwords_available_for_user() | Checks if Application Passwords is available for a specific user. |
wp-includes/class-wp-query.php:WP_Query::generate_postdata() | Generate post data. |
wp-includes/class-wp-customize-manager.php:WP_Customize_Manager::get_lock_user_data() | Gets lock user data. |
wp-includes/rest-api/endpoints/class-wp-rest-users-controller.php:WP_REST_Users_Controller::get_user() | Get the user, if the ID is valid. |
wp-includes/rest-api/endpoints/class-wp-rest-users-controller.php:WP_REST_Users_Controller::delete_item() | Deletes a single user. |
wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php:WP_REST_Posts_Controller::prepare_item_for_database() | Prepares a single post for create or update. |
wp-includes/embed.php:get_oembed_response_data() | Retrieves the oEmbed response data for a given post. |
wp-admin/includes/class-wp-posts-list-table.php:WP_Posts_List_Table::column_title() | Handles the title column output. |
wp-admin/includes/ajax-actions.php:wp_ajax_destroy_sessions() | Ajax handler for destroying multiple open sessions for a user. |
wp-admin/includes/export.php:wxr_authors_list() | Output list of authors with posts |
wp-admin/includes/deprecated.php:get_editable_user_ids() | Gets the IDs of any users who can edit posts. |
wp-includes/capabilities.php:grant_super_admin() | Grants Super Admin privileges. |
wp-includes/capabilities.php:revoke_super_admin() | Revokes Super Admin privileges. |
wp-admin/includes/ms.php:refresh_user_details() | Cleans the user cache for a specific user. |
wp-admin/includes/misc.php:wp_check_locked_posts() | Checks lock status for posts displayed on the Posts screen. |
wp-admin/includes/misc.php:wp_refresh_post_lock() | Checks lock status on the New/Edit Post screen and refresh the lock. |
wp-admin/includes/schema.php:populate_network() | Populate network settings. |
wp-admin/includes/user.php:default_password_nag_edit_user() | |
wp-admin/includes/user.php:edit_user() | Edit user settings based on contents of $_POST |
wp-admin/includes/user.php:get_user_to_edit() | Retrieve user data and filter it. |
wp-admin/includes/class-wp-users-list-table.php:WP_Users_List_Table::single_row() | Generate HTML for a single row on the users.php admin panel. |
wp-admin/includes/post.php:wp_check_post_lock() | Determines whether the post is currently being edited by another user. |
wp-admin/includes/post.php:_admin_notice_post_locked() | Outputs the HTML for the notice to say that someone else is editing or has taken over editing of this post. |
wp-admin/includes/ajax-actions.php:wp_ajax_wp_fullscreen_save_post() | Ajax handler for saving posts from the fullscreen editor. |
wp-admin/includes/ajax-actions.php:wp_ajax_add_user() | Ajax handler for adding a user. |
wp-admin/includes/ajax-actions.php:wp_ajax_inline_save() | Ajax handler for Quick Edit saving a post from a list table. |
wp-admin/includes/ms.php:confirm_delete_users() | |
wp-includes/capabilities.php:author_can() | Returns whether the author of the supplied post has the specified capability. |
wp-includes/capabilities.php:user_can() | Returns whether a particular user has the specified capability. |
wp-includes/capabilities.php:is_super_admin() | Determines whether user is a site admin. |
wp-includes/pluggable.php:wp_new_user_notification() | Email login credentials to a newly-registered user. |
wp-includes/pluggable.php:wp_notify_postauthor() | Notify an author (and/or others) of a comment/trackback/pingback on a post. |
wp-includes/pluggable.php:wp_notify_moderator() | Notifies the moderator of the site about a new comment that is awaiting approval. |
wp-includes/pluggable.php:wp_generate_auth_cookie() | Generates authentication cookie contents. |
wp-includes/deprecated.php:user_can_create_post() | Whether user can create a post. |
wp-includes/deprecated.php:user_can_create_draft() | Whether user can create a post. |
wp-includes/deprecated.php:user_can_edit_post() | Whether user can edit a post. |
wp-includes/deprecated.php:user_can_set_post_date() | Whether user can set new posts’ dates. |
wp-includes/deprecated.php:user_can_edit_post_date() | Whether user can delete a post. |
wp-includes/deprecated.php:user_can_edit_user() | Can user can edit other user. |
wp-includes/class-wp.php:WP::register_globals() | Set up the WordPress Globals. |
wp-includes/class-wp-query.php:WP_Query::get_queried_object() | Retrieves the currently queried object. |
wp-includes/link-template.php:get_edit_user_link() | Retrieves the edit user link. |
wp-includes/link-template.php:get_permalink() | Retrieves the full permalink for the current post or post ID. |
wp-includes/admin-bar.php:wp_admin_bar_edit_menu() | Provides an edit link for posts and terms. |
wp-includes/user.php:wp_update_user() | Updates a user in the database. |
wp-includes/user.php:wp_insert_user() | Inserts a user into the database. |
wp-includes/user.php:is_user_member_of_blog() | Finds out whether a user is a member of a given blog. |
wp-includes/user.php:setup_userdata() | Sets up global user vars. |
wp-includes/user.php:wp_dropdown_users() | Creates dropdown HTML content of users. |
wp-includes/user.php:get_user_option() | Retrieves user option that can be either per Site or per Network. |
wp-includes/canonical.php:redirect_canonical() | Redirects incoming links to the proper URL based on the site url. |
wp-includes/ms-functions.php:wpmu_welcome_user_notification() | Notifies a user that their account activation has been successful. |
wp-includes/ms-functions.php:wpmu_log_new_registrations() | Logs the user email, IP, and registration date of a new site. |
wp-includes/ms-functions.php:newuser_notify_siteadmin() | Notifies the network admin that a new user has been activated. |
wp-includes/ms-functions.php:wpmu_welcome_notification() | Notifies the site administrator that their site activation was successful. |
wp-includes/ms-functions.php:add_user_to_blog() | Adds a user to a blog, along with specifying the user’s role. |
wp-includes/ms-functions.php:remove_user_from_blog() | Removes a user from a blog. |
wp-includes/author-template.php:get_author_posts_url() | Retrieves the URL to the author page for the user with the ID provided. |
wp-includes/author-template.php:wp_list_authors() | Lists all the authors of the site, with several options available. |
wp-includes/author-template.php:get_the_author_meta() | Retrieves the requested data of the author of the current post. |
wp-includes/author-template.php:get_the_modified_author() | Retrieves the author who last edited the current post. |
wp-includes/class-wp-xmlrpc-server.php:wp_xmlrpc_server::mw_getPost() | Retrieve post. |
wp-includes/class-wp-xmlrpc-server.php:wp_xmlrpc_server::mw_getRecentPosts() | Retrieve list of recent posts. |
wp-includes/class-wp-xmlrpc-server.php:wp_xmlrpc_server::mw_newPost() | Create a new post. |
wp-includes/class-wp-xmlrpc-server.php:wp_xmlrpc_server::wp_getUser() | Retrieve a user. |
wp-includes/class-wp-xmlrpc-server.php:wp_xmlrpc_server::wp_getProfile() | Retrieve information about the requesting user. |
wp-includes/class-wp-xmlrpc-server.php:wp_xmlrpc_server::_prepare_page() | Prepares page data for return in an XML-RPC object. |
wp-includes/class-wp-xmlrpc-server.php:wp_xmlrpc_server::_insert_post() | Helper method for wp_newPost() and wp_editPost(), containing shared logic. |
wp-includes/comment-template.php:get_comment_class() | Returns the classes for the comment div as an array. |
wp-includes/comment-template.php:get_comment_author() | Retrieves the author of the current comment. |
wp-includes/comment.php:wp_allow_comment() | Validates whether this comment is allowed to be made. |
Changelog
Version | Description |
---|---|
0.71 | Introduced. |