Critical bug when using WPML + ACF

the powerful plugins WPML for multilingualism and advanced custom fields for own fields are part of the basic equipment of many installations. it's annoying when malfunctions with data loss occur in interaction. the bug reports on this topic are already several years old and unanswered(here and here and here and here and here). i've taken a closer look at the problem.

The error always occurs when creating a so-called ACF options page:


To reproduce the bug, do the following. First, set the language to "German" in the menu at the top of the dashboard. Now you open the menu item "Options" twice (each in a tab). It is important here to call up the menu item directly. In the second tab you now change the language (in our example to "English"). Now make changes in the first tab and click on "Update". Now the contents of all German fields have incorrectly landed in the English fields:

The whole thing happens without warning and is particularly fatal if a large number of options are overwritten.

The following hotfix in functions.php solves the problem (don't forget to exchange "acf-options" if you use an individual slug):