From d8783e2ed023d16d50351fe38678bc555c7a488f Mon Sep 17 00:00:00 2001 From: haritpanchal Date: Fri, 11 Sep 2026 17:30:11 +0530 Subject: [PATCH] Docs: Clarify get_user_meta() return value for a non-existing meta key on a valid user The @return description only covered a non-existing user ID. Per get_metadata_raw()/get_metadata_default(), the same empty-array/empty-string default is also returned when the user exists but the given meta key has no value. Documentation-Issue-Tracker: https://github.com/WordPress/Documentation-Issue-Tracker/issues/2293 --- src/wp-includes/user.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/wp-includes/user.php b/src/wp-includes/user.php index 6ce8dbf05175d..52662ba8daefa 100644 --- a/src/wp-includes/user.php +++ b/src/wp-includes/user.php @@ -1291,8 +1291,10 @@ function delete_user_meta( $user_id, $meta_key, $meta_value = '' ) { * @return mixed An array of values if `$single` is false. * The value of meta data field if `$single` is true. * False for an invalid `$user_id` (non-numeric, zero, or negative value). - * An empty array if a valid but non-existing user ID is passed and `$single` is false. - * An empty string if a valid but non-existing user ID is passed and `$single` is true. + * An empty array if `$single` is false and either the user ID does not exist + * or the meta key does not exist for that user. + * An empty string if `$single` is true and either the user ID does not exist + * or the meta key does not exist for that user. * Note: Non-serialized values are returned as strings: * - false values are returned as empty strings ('') * - true values are returned as '1'