Skip Navigation
availability:

WPML Version: 4.3.12

description:

Some themes load certain menus, such as mobile menus, using AJAX. WPML does not include the language switcher in this case. This filter allows theme authors to add a language switcher to their AJAX-loaded menus.

type:
filter
category:
Site-Wide Language Information
parameters:
$isExcluded
bool Exclude the language switcher from the menu.
hook example usage:

Example

1
2
3
4
5
6
7
add_filter( 'wpml_ls_exclude_in_menu', function( $isExcluded ) {
    if ( isset( $_POST['action'] ) && 'my_ajax_load_menu_action' === $_POST['action'] ) {
        return false;
    }
 
    return $isExcluded;
} );