WordPress.org

Ready to get started?Download WordPress

Forums

Polylang
[resolved] Conflict: Custom Field Template - CF data erased when new translations are added (9 posts)

  1. wishpony
    Member
    Posted 1 year ago #

    First of all, thanks for this great plugin!

    I'm running the most current version of each:

    I just started using Polylang yesterday and love it. However, when I add a new translation for a post, it erases the data previously populated and saved to the original post using the Custom Field Template.

    In order for it to work with CFT, I have to:

    1. Type and save English post
    2. Add and save additional translations (e.g. German and French)
    3. Go back to English post to populate custom field template and save again.

    If I populate the custom field template prior to adding new translations, the date is erased (even after saving).

    If I need to add a fourth translation (Dutch) a little later, the custom fields values are once again erased and have to be repopulated after adding the 4th translation.

    It seems to work OK with Custom Field Template deactivated. I can add posts later without erasing the original custom fields values, so it must be something like the former issue some had with the Advanced Custom Fields plugin.

    I use a lot of custom fields on my sites so the Custom Field Template saves me a lot of time. It would be great if both these great plugins could work together.

    Thank you again for the nice plugin.

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

  2. Chouby
    Member
    Plugin Author

    Posted 1 year ago #

    If you don't need to synchronize your custom fields between translations, go to Polylang settings and de-activate the synchronization for custom fields. Hopefully it should solve the issue.

    If you need to synchronize the custom fields, then try this:
    edit polylang/include/admin-filters.php and modify the line 59 from
    add_action('save_post', array(&$this, 'save_post'), 10, 2);
    to
    add_action('save_post', array(&$this, 'save_post'), 200, 2);

  3. wishpony
    Member
    Posted 1 year ago #

    Hi Chouby, thanks for the response. I do need to synchronize the custom fields, so I tried the change on line 59. Unfortunately, it did not work.

    I tested it by adding a new translation to an existing post and the custom fields were still erased.

    Thanks again.

  4. Chouby
    Member
    Plugin Author

    Posted 1 year ago #

    That's not easy... Diving into the code of Custom field template, I discovered that the plugin does not rely on the existence of the custom fields to decide to populate the values in the form. So for a new post (new translation), it populates the default values even if Polylang does its job correctly and copies the custom fields into the translated post.

    I tried something... Please test the development version and tell me if it works as you expect.
    http://downloads.wordpress.org/plugin/polylang.zip

  5. wishpony
    Member
    Posted 1 year ago #

    Sorry for the slight delay; I've been under the weather.

    I've just tested the development version and it works perfectly with Custom Field Template.

    Thank you very much for the great support and again for this brilliant plugin. I'll be sure to give it a 5-star rating and make a donation as soon as I can.

    Cheers!

  6. wishpony
    Member
    Posted 1 year ago #

  7. Matt Rad
    Member
    Posted 1 year ago #

    Hi Chouby,

    I have been having a similar problem. I thought I might let you know about it in case it helps you or any others with similar trouble. This thread and this one helped me solve my problem.

    We use a theme (Modernize) with custom fields used to structure our static homepage. When we updated Polylang to 1.0.1, the English language custom field content was overwritten with Japanese, even though the rest of the page structure remained in English. Repopulating the fields on the English homepage with English content overwrote the Japanese on the Japanese home. Previous versions of Polylang did not cause this issue.

    Unchecking "Custom fields" in Synchronization under Language Settings seems to have solved the problem.

  8. Chouby
    Member
    Plugin Author

    Posted 1 year ago #

    Yes. Previous versions of Polylang did not synchronize custom fields. This is a new feature which is appreciated by some people but can cause some issues with some themes or plugins. So the first thing to try in case of problem with custom fields is to uncheck the synchronization option in Polylang settings.

  9. Chouby
    Member
    Plugin Author

    Posted 10 months ago #

    @wishpony
    I modified the compatibility code between Polylang and Custom field template to enable compatibility between Polylang and another plugin (The Event Calendar).

    I made some tests with the latest version of Custom field template (2.1.5) and it seems to work as expected.

    If you want to test the modified version before the next official release, you can test the development version (1.1.1.3)
    http://downloads.wordpress.org/plugin/polylang.zip

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic