Support » Plugin: Polylang » Polylang and ACF: post taxonomies being reset on save

  • Hi,

    My permalinks settings: post name
    Using a static front page: YES
    Polylang settings: Polish (pl), English (en)

    I have latest versions of Polylang and ACF4 installed.

    Simply when I save post in one language (a custom post type), in the other language all taxonomy fields are emptied.

    Does anybody experience this?

    Chris

    https://wordpress.org/plugins/polylang/

Viewing 11 replies - 1 through 11 (of 11 total)
  • Plugin Support Chrystl

    (@chrystl)

    Hi
    It happens only with your custom post type and how did you create it?

    No, it happens also on standard posts, but only with custom taxonomy. However I noticed that in the sidebar meta box the terms are correct after changing in either language. BUT not in the ACF field, which is empty.

    So, seems like this is a problem with ACF taxonomy field. Am I right?

    Plugin Support Chrystl

    (@chrystl)

    Did you uncheck the “Custom fields” in the Synchronization option (Settings > Languages > Settings > Synchronization)?

    Yes, it is unchecked because I don’t want to sync all custom fields, just specific ones. I use the “pll_copy_post_metas” action and it works for all fields I pass, but not for taxonomy fields.

    Plugin Support Chrystl

    (@chrystl)

    I tested and I didn’t reproduce your issue.
    I read on ACF forum that it’s recommended to keep unchecked the “Custom fields” in the Polylang settings when using ACF plugin.

    You should make your tests without your custom code.

    It took a while but… 😉 I tested the synchronization on a clean WP install. Still the same. Can you please confirm that this works for you and is not a bug:

    1. Install Advanced Custom Fields and Polylang.
    2. Add a custom post type with a hierarchical custom taxonomy assigned (I used CPT UI plugin for this).
    3. Add an ACF taxonomy field for the custom post type using the custom taxonomy.
    4. Configure Polylang to translate the custom post and taxonomy. Set synchronization for Taxonomies and NOT Custom fields.
    5. Add filter in code to sync the ACF custom field manually:

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

    6. Add a new custom post and set the ACF field.
    7. Add a translation for the new post. Now I see that the field is empty (it should already be synced right?). When I set the field and hit save, the field in the original post gets cleared. The same happens the other way, when I update the field in the original post, it gets cleared in the translation though it was set before.

    So, is it a bug?

    Plugin Support Chrystl

    (@chrystl)

    Please provide some screenshots (of steps 2, 3, 6, 7) it will help me to reproduce your test easily.

    Which version are you using of:
    *ACF,
    *CPT UI
    *Polylang,
    *WordPress ?

    Hello,

    i do have the same problem.

    I got this problem with all taxonomies where i set the “translate option” false. But i still need those taxonomies for the other language (like a name of an artist, in both language the same). these taxonomies i do have to select again, they are not copied to the other language.

    M.

    with this code in my function.php it works!

    add_filter( ‘pll_copy_taxonomies’, ‘copy_tax’, 10, 2 );

    function copy_tax( $taxonomies, $sync ) {
    $taxonomies[] = ‘my_custom_tax’;
    return $taxonomies;
    }

Viewing 11 replies - 1 through 11 (of 11 total)
  • The topic ‘Polylang and ACF: post taxonomies being reset on save’ is closed to new replies.