switch_to_locale
Switches the translations according to the given locale.
Description
switch_to_locale( (string) $locale );
Parameters (1)
- 0. $locale (string)
- The locale.
Usage
if ( !function_exists( 'switch_to_locale' ) ) { require_once ABSPATH . WPINC . '/l10n.php'; } // The locale. $locale = ''; // NOTICE! Understand what this does before running. $result = switch_to_locale($locale);
Defined (1)
The function is defined in the following location(s).
- /wp-includes/l10n.php
- function switch_to_locale( $locale ) {
- /** @var WP_Locale_Switcher $wp_locale_switcher */
- global $wp_locale_switcher;
- return $wp_locale_switcher->switch_to_locale( $locale );
- }