From dfa14f95bbb311f863a329b1e8bc967ccdbf0c8b Mon Sep 17 00:00:00 2001 From: joedolson Date: Sat, 28 Sep 2024 23:08:18 +0000 Subject: [PATCH] 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. Built from https://develop.svn.wordpress.org/trunk@59111 git-svn-id: http://core.svn.wordpress.org/trunk@58507 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/user.php | 13 +++++++++++++ wp-includes/version.php | 2 +- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/wp-includes/user.php b/wp-includes/user.php index c234c495df..b23e07e0ac 100644 --- a/wp-includes/user.php +++ b/wp-includes/user.php @@ -775,6 +775,19 @@ function delete_user_option( $user_id, $option_name, $is_global = false ) { return delete_user_meta( $user_id, $option_name ); } +/** + * Retrieves user info by user ID. + * + * @since 6.7 + * + * @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 ); +} + /** * Retrieves list of users matching criteria. * diff --git a/wp-includes/version.php b/wp-includes/version.php index b7dc76e86d..ccb8e79c4a 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -16,7 +16,7 @@ * * @global string $wp_version */ -$wp_version = '6.7-alpha-59110'; +$wp_version = '6.7-alpha-59111'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.