• Resolved 46cl

    (@46cl)


    Il use polylang 1.9.3 and I try to synch custom metasdatas in all languages by using this :

    add_filter('pll_copy_post_metas', function ($metas) {
        if (get_post_type() == 'projet') {
            return array_merge($metas, array(
                'galerie'
            ));
        }
    });

    And I get thoses errors only when I translate a post. Of course no data is synch (not even the thumbnail)

    Warning: array_merge(): Argument #1 is not an array in /my-folder/wp-content/themes/bach-nguyen-architecture/config/metaboxes/projet.php on line 69
    
    Warning: array_unique() expects parameter 1 to be array, null given in /my-folder/wp-content/plugins/polylang/modules/sync/admin-sync.php on line 202
    
    Warning: Invalid argument supplied for foreach() in /my-folder/wp-content/plugins/polylang/modules/sync/admin-sync.php on line 205

    NB : When I remove the pll_copy_post_metas filter I still have the last 2 errors

    Can anybody help me ?

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

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

    (@chouby)

    Hi!

    Please make a test with Twenty Sixteen + Polylang only. Then switch to your theme and activate other plugins one by one to find out the conflict source.

    Thread Starter 46cl

    (@46cl)

    The problem comes from my theme not from other plugin

    Thread Starter 46cl

    (@46cl)

    I’ve found the solution : I forgot to put return $metas; in another pll_copy_post_metas filter

    add_filter('pll_copy_post_metas', function ($metas) {
        if (get_post_type() == 'projet') {
            return array_merge($metas, array(
                'galerie'
            ));
        }
        return $metas;
    });
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Problème with duplication of’ is closed to new replies.