Support » Plugin: Max Mega Menu » Bug in multilingual environment (Polylang)

  • We are using your plugin on several sites, thanks a lot… Recently we run into interesting bug when adding new menu locations, it just didn’t work correctly. It turns out that in your get_next_menu_location_id() function, you use last() function, to get last array element in order to get last menu id, and in multilingual environments there was a language, instead of a number, so $last_id + 1 didn’t work correctly, when $last_id was “en”.

    Since we are using free version of your plugin, and we can not expect fast fixes, we fixed it for now ourselves, by using fourth element of the array, instead of the last one ($menu_id = $parts[3];).

    Hopefully this is not going to break it 🙂 please let us know if this makes sense, and if it does, please fix in your code that for all of us! thanks!

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author megamenu


    Hi fotkin,

    Thanks for reporting this. What you have said makes sense, but looking at the code (and trying it myself) I’m not able to replicate it.

    I have enabled PolyLang, then gone to Mega Menu > Menu Locations and clicked ‘Add a new menu location’. This gives me 2 new locations (one for the default language, one for my addon language):

    Max Mega Menu Location 1 English
    Max Mega Menu Location 1 German

    Max Mega Menu does not actually store 2 new menu locations (it creates one new location with the id max_mega_menu_1) – it’s PolyLang that’s dynamically creating that second location. If I click “Add another menu location” again, then the code will use “max_mega_menu_1” as the last location, making the next location ID max_mega_menu_2.

    So, I’m having trouble replicating the problem here. Could you provide steps or screenshots which detail the problem?


    Thread Starter fotkin


    Hi Tom,

    Here is my video explanation –

    So, looks like this is related to renaming, there is a bug, which I haven’t tried to find yet 🙂 But I am planning to…


    Plugin Author megamenu


    Hi Dmitri,

    Many thanks for the video – that’s really helpful.

    I now see the issue is when you save a menu location.

    Thinking about it, I don’t think MMM should be displaying a new location for each of the languages in this instance. It should only show one (non-translated) menu location, not duplicating it for each language. PolyLang should handle the translation of menu locations itself on the Appearance > Menus page.

    I will work on a fix for this for the next release.


Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Bug in multilingual environment (Polylang)’ is closed to new replies.