Skip to content
Docs
Get RestroPress

Action

wpml_switch_language

Updated
On this page

Calls WPML's action to switch the active language.

RestroPress fires this WPML action to switch to the order's language before building order emails, and again to restore the original language after the emails have been sent. The language switch applies to the current request only.

Parameters#

ParameterTypeDescription
$language_codestringThe language code to switch to.

Example#

add_action( 'wpml_switch_language', 'my_log_language_switch', 10, 1 );
function my_log_language_switch( $language_code ) {
	error_log( 'Language switched to ' . $language_code );
}

Notes#

Fired from rpress_wpml_switch_language_for_order() with the order's language and from rpress_wpml_restore_language() with the previously active language.

Source#

Fired from:

  • includes/plugin-compatibility.php (line 629), in rpress_wpml_switch_language_for_order()
  • includes/plugin-compatibility.php (line 665), in rpress_wpml_restore_language()

See also#

Was this page helpful?