- availability:
-
WPML Version: 4.1.0
- description:
-
This filter is used when the theme developer wants to use a custom JavaScript for handling the browser redirection.
This filters a boolean set to
true
by default.
If the filter returnsfalse
, the JavaScript which takes care of redirecting the visitor won’t be enqueued.
The filter is applied only if thewpml_browser_redirect_language_params
filter returns a valid$param
(pageLanguage
andlanguageUrls
must be set). - type:
- filter
- category:
- Site-Wide Language Information
- parameters:
-
pageLanguage
– defines a language for the pagelanguageUrls
– an array that contains pairs of languages and URLs to which browser should be redirected - hook example usage:
-
In order to use this filter Browser language redirect must be enabled on the WPML -> Languages.
The following code can be used to disable the redirect feature on a specific page:
function example( $enqueue ) { global $post; // Do not enqueue the scripts if the page ID is 123 if ( $post->ID === 123 ) { $enqueue = false; } return $enqueue; } add_filter( 'wpml_enqueue_browser_redirect_language', 'example' );