NateWr / food-and-drink-menu

WordPress plugin to create a food and drink menu
33 stars 14 forks source link

Polylang: Menu sections emptied #50

Open strarsis opened 6 years ago

strarsis commented 6 years ago

@NateWr: Polylang is used to translate a FDM menu. When saving a FDM menu in particular language with specific FDM menu sections (which also are in that respective language), the sections of other languages of that FDM menu are emptied.

Steps to reproduce:

  1. Install FDM + Polylang
  2. Set two Polylang languages
  3. Create a new FDM section.
  4. Save the FDM section with both languages (e.g. 'Wines' and 'Vins').
  5. Create a new FDM menu (e.g. 'Drinks').
  6. Add the previously created FDM section to the FDM menu (correctly only the FDM sections with same language as FDM menu are listed).
  7. Save the FDM menu (with its current translation).
  8. Swtich to the other language of FDM menu.
  9. Add the FDM section to the FDM menu.
  10. Save the FDM menu.
  11. Again, switch to other language of FDM menu. Notice that the sections had been lost.

Polylang saves for each translation a different post with different ID, when the field is just copied over, the ID of a different language is used.

Edit: It seems to be fixed by replacing in Food and Drink menu wpml-config.xml

    <custom-field action="copy">fdm_menu_column_one</custom-field>
    <custom-field action="copy">fdm_menu_column_two</custom-field>

with

    <custom-field action="translate">fdm_menu_column_one</custom-field>
    <custom-field action="translate">fdm_menu_column_two</custom-field>

Apparently it isn't possible to override these settings from within another (site specific) plugin wpml-config.xml.

strarsis commented 6 years ago

@NateWr: How can I further help debugging this issue?