• Resolved kuyabiye

    (@kuyabiye)


    The plugin works great, i have only an issue about it. I am using the plugin “advanced custom fields”. i have a checkbox field and i have 3 translations. for example when i change the value of checkbox in english translation, the value of the checkboxs are in other translations becomes unchecked. so it is not possible to assign the same value for all checkboxes. i tried it in other types of custom fields, it works like that too.

    https://www.ads-software.com/extend/plugins/polylang/

Viewing 9 replies - 1 through 9 (of 9 total)
  • Plugin Author Chouby

    (@chouby)

    There is something wrong with the synchronization of custom fields. I will check that. Waiting for this, you can go in Polylang settings and uncheck the synchronization of custom fields. this should solve your issue.

    Plugin Author Chouby

    (@chouby)

    OK I found the reason for the conflict with acf. Polylang synchronizes custom fields before ACF saves them.

    Waiting for a new release, you can edit the file polylang/include/admin-filters.php at line 59 (v1.0.1) and replace:

    add_action('save_post', array(&$this, 'save_post'), 10, 2);

    by

    add_action('save_post', array(&$this, 'save_post'), 25, 2); // priority 25 to come after acf

    Thread Starter kuyabiye

    (@kuyabiye)

    it works, thanks!

    Hi,
    Polylang is really great, easy to use and powerful!
    I had an issue with custom fields translations overwriting all other translations.
    I unchecked the synchronization of custom fields in the admin panel and now it works great!

    I have this same issue too, but only partially.

    I could solve the overriding issue and maintaining the synchronization by including at wpml-config.xml file each custom field defining a translation action.

    Polylang by default (judging by the behaviour) seems to take copy action.

    All those fields come from Types plugin that I’m using.

    <custom-fields>
     	<custom-field action="translate">cf1</custom-field>
    	<custom-field action="translate">cf2</custom-field>
    	<custom-field action="translate">cf3</custom-field>
    </custom-fields>

    On the other hand I’m using Attachments plugin that handles images upload with several custom fields for descripton.

    These custom fields are organized in an array within a row at wp_postmeta table.

    For such case, the lines structure of the wpml-config.xml file for custom fields should be diferent than the one pointed above.

    It would have to be something like:

    <custom-fields>
          <custom-fields-group="name_of_key">
                 <custom-field action="translate">cf1</custom-field>
                 <custom-field action="translate">cf2</custom-field>
          </custom-fields-group="name_of_key">
    </custom-fields>

    I don’t find anywhere mentioned this kind of structure for custom fields the same way it exists for <admin-texts>.

    If my thoughts on this went on the right direction, I’m disabling custom fields synchronization too.

    Plugin Author Chouby

    (@chouby)

    Yes by default Polylang copies all public custom fields (the synchronization is optional). Hidden custom fields are not copied (except page template and featured image which are in fact hidden custom fields).

    To modify this comportment, one has to code and use the ‘pll_copy_post_metas’ filter or use a wpml-config.xml file as you do.
    Actions “translate” and “copy” have the same comportment in Polylang (the custom fields are copied, not synchronized even if the synchronization option is active) as I don’t understand what difference WPML makes between the two actions. The action “ignore” just ignores the custom field which is not copied.

    The “custom-fields-group” section is not documented by WPML. If it exists, then it is not implemented in Polylang. For Polylang an array of custom fields is a unique custom field.

    The difference between copy and translate according what I’ve experienced:

    Copy – Populates the field value with the last saved version in every correspondent language versions.

    Useful for numeric fields, with just one insertion in any language you get at once all language versions populated with that value.

    Translation – When editing the field pulls the last saved version if empty, when saving it doesn’t populate the value at the rest of correspondent language versions as copy does.

    Useful when creating the translations of a post, it pre poulates the field with the original language value.

    Plugin Author Chouby

    (@chouby)

    So if I well understand:
    Copy: is in fact what I call synchronization (all values are kept the same in all translations)
    Translate: is the default comportment of Polylang when custom field synchronization is deactivated.
    That make sense. I should update Polylang to reflect this.

    And maybe add beside each synchronization checkbox at Polylang settings 1 or 2 note lines describing what it does and how behaves.

    It would turn the configuration easier for users.

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘Custom field values override other translation values’ is closed to new replies.