flyntwp / acf-hide-layout

Easily hide the layout of the flexible content on the frontend but still keep it in the backend.
19 stars 5 forks source link

WPML compatibility? #6

Open timostsauber opened 2 years ago

timostsauber commented 2 years ago

By default it looks like this is set to copy in the WPML Custom Fields Translation settings.

If we wanted to change it to Copy Once, any suggestions on how best to do this globally?

The only way I could see to achieve it was via the Custom Fields Translation settings (See attached), but this is only useful for existing or created posts. It would be nice to set it globally if possible via code?

Thanks for an awesome plugin!!

wpml
domtra commented 2 years ago

Hi @timostsauber , have you tried using the wpml-config.xml file for that. It could be that something like this works:

<wpml-config>
  <custom-fields>
    <custom-field action="copy-once">*_acf_hide_layout</custom-field>
  </custom-fields>
</wpml-config>

It might be, however, that the wildcard syntax only works in attributes. But I am not 100% sure.

The thing is that the acf_hide_value is a meta value but no real ACF field. This is why hooking into ACF fields definition will not work. And I am not really sure how to programatically handle the translation settings for regular meta fields.

Let me know if this works.