Home>Support>2.31.3 Feature “WPML: Improved compatibility by excluding panels_data” cause problem

2.31.3 Feature “WPML: Improved compatibility by excluding panels_data” cause problem

Hello !
I use Polylang on my websites, and Site Origin to handle content page.

Recently, I’ve noticed that I have a problem when I create a new translation for a page builded with Site Origin : widgets aren’t loaded in the content admin page. It was working before, so I guessed that something have been changed in latest versions of the siteoriginbuilder plugin, and I’ve found what cause my problem : it’s the new feature “WPML: Improved compatibility by excluding panels_data“.

For the context, when I create a new translation, I have a function that copy the content page of the original post that you can see here :

    function traduction_content_copy( $content ) {
        if ( isset( $_GET['from_post'] ) ) {
            $my_post = get_post( $_GET['from_post'] );
            if ( $my_post )
                return $my_post->post_content;
        }
        return $content;
    }
    add_filter( 'default_content', 'traduction_content_copy' );

The addition of this line in the “wpml-config.xml” file is the origin of the problem :

  <custom-fields>
    <custom-field action="ignore">panels_data</custom-field>
  </custom-fields>

I don’t really know why, so I hope you could find a solution for polylang to not be concerned by this line.

Thank you for your support !

This is our free support forum. Replies can take several days. If you need fast email support, please purchase a SiteOrigin Premium license.

  1. 1 month, 16 days ago xella

    I’ve noticed that the “admin-ajax.php?_panelsnonce=xxxxx” function is not called on my post-new.php admin page with the new line in “wpml-config.xml”. If I remove it, the panelsnonce is called and widgets are loaded.

  2. 1 month, 15 days ago Alex S
    Hi, I Work Here

    Hi Xella,

    Thanks for getting in touch. Are you using Polylang Pro or the base version?

    We made a change in Page Builder 2.31.8 that resolves this compatibility issue for the pro version of Poylang, but the free version of the plugin doesn’t feature direct syncing support. This means that if the PHP you provided is the full extent of the syncing functionality you rely on, you may require additional changes to prevent Polylang from intentionally filtering out panels_data. You can find a copy of the compatibility changes we made here.

    Kind regards,
    Alex

  3. 14 days, 22 hours ago xella

    Hello Alex,

    I use the free version of Polylang. I use a custom code to copy original post content to the translation (the function that I add in my initial message). I’ve find a way to copy panels_data when creating a translation. I’ve created a custom filter, so when I create a new translation, I copy the page builder content from the original post :

        /* Copy content page of original translated post */
        function traduction_content_copy( $content ) {
            if ( isset( $_GET['from_post'] ) ) {
                $my_post = get_post( $_GET['from_post'] );
                if ( $my_post )
                    return $my_post->post_content;
            }
            return $content;
        }
        add_filter( 'default_content', 'traduction_content_copy' );
    
        // Copy custom metas for Page Builder datas and page thumbnail when creating a translation
        add_filter( 'pll_copy_post_metas', 'copy_post_metas_panels_data', 23, 2 );
        function copy_post_metas_panels_data( $metas, $sync ) {
            if($sync) {
                return $metas;
            }else {
                return array_merge( $metas, array( 'panels_data', '_thumbnail_id' ) );
            }
        }
    

    It resolve my issue, but I think you could fix this problem by doing the same thing in the page builder polylang file, in the function “copy_panels_data”, you could do it like this, as it was in the function before the upgrade of version 23.3.1.3 (https://github.com/siteorigin/siteorigin-panels/blob/4c9e032b2107f01ae29c16466fd5c302962501b7/compat/polylang.php) :

    public function copy_panels_data( $keys, $sync, $from, $to, $lang ) {
        if ( $this->is_sync_enabled( $from, $to, $lang ) ) {
            $keys[] = 'panels_data';
        } else {
            <strong>if($sync) {
                // To avoid potential syncing issues, we need to make sure that
                // 'panels_data' is not included in the keys to copy.
                $keys = array_diff( $keys, array( 'panels_data' ) );
            }else {
                // When sync is not enabled, we copy panels meta data when a translation is created.
                $keys[] = 'panels_data';
            }</strong>
        }
        
        return $keys;
    }
    
Please log in to post on our forums. Signing up is free.

Get The Most Out of SiteOrigin with SiteOrigin Premium

Find Out More