get_user_locale( int|WP_User $user_id )
Retrieves the locale of a user.
Description #Description
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().
Parameters #Parameters
Return #Return
(string) The locale of the user.
Source #Source
File: wp-includes/l10n.php
function get_user_locale( $user_id = 0 ) { $user = false; if ( 0 === $user_id && function_exists( 'wp_get_current_user' ) ) { $user = wp_get_current_user(); } elseif ( $user_id instanceof WP_User ) { $user = $user_id; } elseif ( $user_id && is_numeric( $user_id ) ) { $user = get_user_by( 'id', $user_id ); } if ( ! $user ) { return get_locale(); } $locale = $user->locale; return $locale ? $locale : get_locale(); }
Expand full source code Collapse full source code View on Trac
Changelog #Changelog
Version | Description |
---|---|
4.7.0 | Introduced. |
Related #Related
Uses #Uses
Uses | Description |
---|---|
wp-includes/l10n.php: get_locale() |
Retrieves the current locale. |
wp-includes/pluggable.php: wp_get_current_user() |
Retrieve the current user object. |
wp-includes/pluggable.php: get_user_by() |
Retrieve user info by a given field |
Used By #Used By
Used By | Description |
---|---|
wp-admin/includes/class-wp-debug-data.php: WP_Debug_Data::debug_data() |
Static function for generating site debug data when required. |
wp-includes/l10n.php: determine_locale() |
Determine the current locale desired for the request. |
wp-includes/script-loader.php: wp_default_packages_vendor() |
Registers all the WordPress vendor scripts that are in the standardized |
wp-includes/script-loader.php: wp_default_packages_inline_scripts() |
Adds inline scripts required for the WordPress JavaScript packages. |
wp-includes/user.php: _wp_privacy_send_erasure_fulfillment_notification() |
Notify the user when their erasure request is fulfilled. |
wp-includes/user.php: wp_send_user_request() |
Send a confirmation request email to confirm an action. |
wp-admin/includes/privacy-tools.php: wp_privacy_send_personal_data_export_email() |
Send an email to the user with a link to the personal data export file |
wp-includes/ms-functions.php: update_network_option_new_admin_email() |
Send a confirmation request email when a change of network admin email address is attempted. |
wp-includes/class-wp-editor.php: _WP_Editors::get_mce_locale() | |
wp-admin/includes/class-wp-community-events.php: WP_Community_Events::get_request_args() |
Builds an array of args to use in an HTTP request to the w.org Events API. |
wp-includes/rest-api/endpoints/class-wp-rest-users-controller.php: WP_REST_Users_Controller::prepare_item_for_response() |
Prepares a single user output for response. |
wp-includes/customize/class-wp-customize-selective-refresh.php: WP_Customize_Selective_Refresh::export_preview_data() |
Exports data in preview after it has finished rendering so that partials can be added at runtime. |
wp-admin/includes/theme.php: themes_api() |
Retrieves theme installer pages from the WordPress.org Themes API. |
wp-admin/includes/misc.php: update_option_new_admin_email() |
Send a confirmation request email when a change of site admin email address is attempted. |
wp-admin/includes/plugin-install.php: plugins_api() |
Retrieves plugin installer pages from the WordPress.org Plugins API. |
wp-admin/includes/dashboard.php: wp_dashboard_cached_rss_widget() |
Checks to see if all of the feed url in $check_urls are cached. |
wp-admin/includes/dashboard.php: wp_dashboard_rss_control() |
The RSS dashboard widget control. |
wp-admin/includes/dashboard.php: wp_dashboard_browser_nag() | |
wp-admin/includes/class-wp-plugin-install-list-table.php: WP_Plugin_Install_List_Table::prepare_items() | |
wp-admin/includes/template.php: iframe_header() |
Generic Iframe header for use with Thickbox |
wp-admin/includes/import.php: wp_get_popular_importers() |
Returns a list from WordPress.org of popular importer plugins. |
wp-admin/includes/credits.php: wp_credits() |
Retrieve the contributor credits. |
wp-includes/class-wp-customize-manager.php: WP_Customize_Manager::customize_preview_settings() |
Print JavaScript settings for preview frame. |
wp-includes/pluggable.php: wp_new_user_notification() |
Email login credentials to a newly-registered user. |
wp-includes/class-wp-theme.php: WP_Theme::sort_by_name() |
Sorts themes by name. |
wp-includes/functions.php: wp_auth_check_html() |
Output the HTML that shows the wp-login dialog when the user is no longer logged in. |
wp-includes/user.php: wp_update_user() |
Update a user in the database. |
wp-includes/ms-functions.php: wpmu_welcome_user_notification() |
Notify a user that their account activation has been successful. |
wp-includes/ms-functions.php: wpmu_welcome_notification() |
Notify a user that their blog activation has been successful. |
wp-includes/ms-functions.php: wpmu_signup_blog_notification() |
Send a confirmation request email to a user when they sign up for a new site. The new site will not become active until the confirmation link is clicked. |
wp-includes/ms-functions.php: wpmu_signup_user_notification() |
Send a confirmation request email to a user when they sign up for a new user account (without signing up for a site at the same time). The user account will not become active until the confirmation link is clicked. |
wp-includes/class-wp-customize-widgets.php: WP_Customize_Widgets::export_preview_data() |
Communicates the sidebars that appeared on the page at the very end of the page, and at the very end of the wp_footer, |
wp-includes/class-wp-editor.php: _WP_Editors::editor_settings() |