[wp-trac] [WordPress Trac] #35124: Add get_user() function that maps to get_user_by()
WordPress Trac
noreply at wordpress.org
Wed Dec 16 19:20:23 UTC 2015
#35124: Add get_user() function that maps to get_user_by()
-------------------------+-----------------------------
Reporter: sc0ttkclark | Owner:
Type: enhancement | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Users | Version:
Severity: normal | Keywords:
Focuses: |
-------------------------+-----------------------------
{{{#!php
<?php
/**
* 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.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/35124>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list