On this page
switch_to_locale( string $locale ): bool
Switches the translations according to the given locale.
Parameters
$localestring Required-
The locale.
Return
bool True on success, false on failure.
Source
File: wp-includes/l10n.php. View all references
function switch_to_locale( $locale ) {
/* @var WP_Locale_Switcher $wp_locale_switcher */
global $wp_locale_switcher;
return $wp_locale_switcher->switch_to_locale( $locale );
}
Related
Uses
| Uses | Description |
|---|---|
| WP_Locale_Switcher::switch_to_locale() wp-includes/class-wp-locale-switcher.php | Switches the translations according to the given locale. |
Used By
| Used By | Description |
|---|---|
| wpmu_new_site_admin_notification() wp-includes/ms-functions.php | Notifies the Multisite network administrator that a new site was created. |
| WP_Recovery_Mode_Email_Service::send_recovery_mode_email() wp-includes/class-wp-recovery-mode-email-service.php | Sends the Recovery Mode email to the site admin email address. |
| _wp_privacy_send_erasure_fulfillment_notification() wp-includes/user.php | Notifies the user when their erasure request is fulfilled. |
| wp_send_user_request() wp-includes/user.php | Send a confirmation request email to confirm an action. |
| wp_privacy_send_personal_data_export_email() wp-admin/includes/privacy-tools.php | Send an email to the user with a link to the personal data export file |
| update_network_option_new_admin_email() wp-includes/ms-functions.php | Sends a confirmation request email when a change of network admin email address is attempted. |
| WP_Customize_Selective_Refresh::export_preview_data() wp-includes/customize/class-wp-customize-selective-refresh.php | Exports data in preview after it has finished rendering so that partials can be added at runtime. |
| retrieve_password() wp-includes/user.php | Handles sending a password retrieval email to a user. |
| update_option_new_admin_email() wp-admin/includes/misc.php | Sends a confirmation request email when a change of site admin email address is attempted. |
| insert_with_markers() wp-admin/includes/misc.php | Inserts an array of strings into a file (.htaccess), placing it between BEGIN and END markers. |
| WP_Customize_Manager::customize_preview_settings() wp-includes/class-wp-customize-manager.php | Prints JavaScript settings for preview frame. |
| wp_new_user_notification() wp-includes/pluggable.php | Emails login credentials to a newly-registered user. |
| wp_notify_postauthor() wp-includes/pluggable.php | Notifies an author (and/or others) of a comment/trackback/pingback on a post. |
| wp_notify_moderator() wp-includes/pluggable.php | Notifies the moderator of the site about a new comment that is awaiting approval. |
| wp_update_user() wp-includes/user.php | Updates a user in the database. |
| wpmu_welcome_user_notification() wp-includes/ms-functions.php | Notifies a user that their account activation has been successful. |
| wpmu_welcome_notification() wp-includes/ms-functions.php | Notifies the site administrator that their site activation was successful. |
| wpmu_signup_blog_notification() wp-includes/ms-functions.php | Sends 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. |
| wpmu_signup_user_notification() wp-includes/ms-functions.php | Sends 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_Customize_Widgets::export_preview_data() wp-includes/class-wp-customize-widgets.php | Communicates the sidebars that appeared on the page at the very end of the page, and at the very end of the wp_footer, |
Changelog
| Version | Description |
|---|---|
| 4.7.0 | Introduced. |
© 2003–2022 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/functions/switch_to_locale