# Use a Different Menu Per Language in WPML

> Shows a completely different menu in a theme location for each WPML language, for sites whose language versions have different structures rather than translated copies.

- Type: PHP
- Runs: Run everywhere
- Category: [Multilingual](https://wpide.com/library/category/multilingual/)
- Tags: wpml, menus, navigation
- Author: WPIDE Team
- Installs: 0
- Updated: 2026-10-28
- Page: https://wpide.com/library/wpml-menu-per-language/

## Code

```php
$wpide_menus = array( // Theme location => array( language code => menu ID ).
    'primary' => array(
        // 'fr' => 12,
        // 'de' => 15,
    ),
);

add_filter( 'wp_nav_menu_args', function ( $args ) use ( $wpide_menus ) {
    if ( ! defined( 'ICL_SITEPRESS_VERSION' ) || empty( $args['theme_location'] ) || ! isset( $wpide_menus[ $args['theme_location'] ] ) ) {
        return $args;
    }

    $lang = apply_filters( 'wpml_current_language', null );
    $map  = $wpide_menus[ $args['theme_location'] ];

    if ( $lang && ! empty( $map[ $lang ] ) && wp_get_nav_menu_object( (int) $map[ $lang ] ) ) {
        $args['menu'] = (int) $map[ $lang ]; // An explicit menu wins over the location's assigned menu.
    }

    return $args;
} );
```

## Notes

Map location => language => menu ID (find IDs in Appearance > Menus, in the URL). Languages not listed keep WPML's usual translated menu.

## How to use it

Install the free WPIDE plugin (https://wordpress.org/plugins/wpide/), find "Use a Different Menu Per Language in WPML" in its snippet library and add it in one click; or create a new PHP snippet in WPIDE (or any code snippets plugin) and paste the code above. More snippets: https://wpide.com/library/
