Make WordPress Core

Opened 6 years ago

Last modified 3 years ago

#35124 new enhancement

Add get_user() function that maps to get_user_by()

Reported by: sc0ttkclark Owned by:
Milestone: Priority: normal
Severity: normal Version:
Component: Users Keywords:
Focuses: Cc:


 * Retrieve user info by user ID.
 * @since 4.5
 * @param int $user_id User ID
 * @return WP_User|false WP_User object on success, false on failure.
function get_user( $user_id ) {
        return get_user_by( 'id', $user_id );

Works like get_userdata but meets the standards of get_{object_type} we've put forth in get_post( $id ) / get_term( $id ) / get_comment( $id ) to make it easier for new developers coming into WordPress.

I imagine at some point we could deprecate get_userdata calls, but not sure that should be done in the same release this is introduced.

Change History (1)

#1 @SergeyBiryukov
6 years ago

Previously suggested in comment:24:ticket:21120.

Note: See TracTickets for help on using tickets.