Function: get_user_locale

get_user_locale( integer | WP_User $user_id )

Retrieves the locale of a user.

If the user has a locale set to a non-empty string then it will be returned. Otherwise it returns the locale of get_locale().


Name Type(s) Default Value Description
$user_id integer | WP_User

User's ID or a WP_User object. Defaults to current user.



The locale of the user.

WordPress Developer Newsletter

Stay on top of the latest WordPress API changes, developer tool updates, security alerts and more.