restore_previous_locale() WordPress Function

The restore_previous_locale() function restores the previous locale if it exists. This is useful if you need to temporarily change the locale, for example to display dates in a different language.

restore_previous_locale() #

Restores the translations according to the previous locale.


Return

(string|false) Locale on success, false on error.


Top ↑

Source

File: wp-includes/l10n.php

function restore_previous_locale() {
	/* @var WP_Locale_Switcher $wp_locale_switcher */
	global $wp_locale_switcher;

	return $wp_locale_switcher->restore_previous_locale();
}


Top ↑

Changelog

Changelog
VersionDescription
4.7.0Introduced.

The content displayed on this page has been created in part by processing WordPress source code files which are made available under the GPLv2 (or a later version) license by theĀ Free Software Foundation. In addition to this, the content includes user-written examples and information. All material is subject to review and curation by the WPPaste.com community.