Make WordPress Core

Changeset 59111


Ignore:
Timestamp:
09/28/2024 11:07:00 PM (2 weeks ago)
Author:
joedolson
Message:

Users: Add get_user() alias.

Add get_user() as an alias for get_user_by( 'id', $user_id ). Add get_user() to user.php so it is not a pluggable function. Bring parity with other standard get_ functions for a more intuitive developer experience.

Props sc0ttkclark, kushang78, joedolson, peterwilsoncc.
Fixes #35124.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/user.php

    r58962 r59111  
    774774
    775775    return delete_user_meta( $user_id, $option_name );
     776}
     777
     778/**
     779 * Retrieves user info by user ID.
     780 *
     781 * @since 6.7
     782 *
     783 * @param int $user_id User ID.
     784 *
     785 * @return WP_User|false WP_User object on success, false on failure.
     786 */
     787function get_user( $user_id ) {
     788    return get_user_by( 'id', $user_id );
    776789}
    777790
Note: See TracChangeset for help on using the changeset viewer.