Support » Plugin: Polylang » polylang not syncing custom fields

  • Resolved Jules Colle

    (@jules-colle)


    I really love your plugin. This is the first time I’m creating a multilingual website in WordPress and I must say your plugin goes far beyond any expectations I had.

    There’s one thing I will need a bit of help with though. I have read the documentation and searched the forums, but I haven’t managed to find a way to sync the fields of my custom types. I have polylang 0.9.1 installed.

    I’m using WP-Types (http://wp-types.com/) to create my custom types and fields, but that shouldn’t matter. I have some experience with creating custom types without any plugins so I kind of know what’s (supposed to be) happening behind the scenes.

    I have a custom post type named ‘office’ which has a custom field called ‘wpcf-address’ (this is the actual meta_key in the DB. I have looked it up)

    In my functions.php I have written the following code:

    add_filter('pll_copy_post_metas', 'copy_post_metas');
    function copy_post_metas($metas) {
          return array_merge($metas, array('wpcf-address'));
    }

    So next I created a new office in English. Filled out the address field and clicked Publish. Then I clicked ‘add new’ next to the language I wanted to translate it to, but all fields are empty, while I expect the address field to be populated with the previous data.

    What could I be doing wrong?

    http://wordpress.org/extend/plugins/polylang/

Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter Jules Colle

    (@jules-colle)

    OK, so turns out it works 🙂 But not really in the way I expected it to.

    So what happens is this: When I have an office that exists in multiple languages, when I update the custom field of one of them, instantaneously this field gets updated in all my translations, so that’s pretty much OK.

    What i wanted to happen is this: When I have an office that exists in only one language, and then create e NEW office, I want some fields to automatically be filled in with the corresponding fields of the original version.

    Is something like that possible? I figure if you have a site with 10 languages and a custom post type with 6 custom fields or more, it would greatly enhance the initial translation process if every time you create a new translation most fields are already pre-filled. What do you think?

    Plugin Author Chouby

    (@chouby)

    It should work like this. I remade tests and it works for me (both copy to new translation and synchronisation between translations).

    However,you must not forget to save your post before adding the new translation.

    Thread Starter Jules Colle

    (@jules-colle)

    Hi Choubi. I forgot about this question for a while. Everything seems to have worked out fine. Thanks for your great plugin!

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘polylang not syncing custom fields’ is closed to new replies.