Skip Navigation
availability:

WPML Version: 3.2.7

description:
  • Run your custom functions right after switching the global current language in WordPress queries.
  • To change the current language, use the wpml_switch_language hook.
type:
action
category:
Site-Wide Language Information
parameters:
add_action( 'wpml_language_has_switched', callable $function_to_add );
$function_to_add
(callable) (Required) Your callback to be run when the filter is applied.
hook example usage:

Example

function my_plugin_actions() {
  // These actions will be executed right after the global current language has just changed. 
}

add_action( 'wpml_language_has_switched', 'my_plugin_actions' );