WPML

Overview of the Issue

When using WPBakery Page Builder 9.1 with WPML 5.4.0 or older, you might experience the following issue: when a translation from the Advanced Translation Editor (ATE) is saved, the translated page loses some elements. The Raw HTML, Raw JS and Google Maps elements are removed. Buttons, call-to-action boxes and other elements that have a custom onclick script are removed too. The original page does not change. The issue happens even when the Send to translation the content of raw HTML cells option is on. The WPBakery plugin that comes with the Uncode theme, version 9.1, has the same issue.

Workaround

This issue will be fixed in an upcoming WPML release. Until then, use one of these workarounds.

Workaround 1: keep WPBakery 9.0.x. Do not update WPBakery Page Builder (or the WPBakery plugin that comes with Uncode) to 9.1 until you update WPML to the fixed version.

Workaround 2: add a small plugin. Make a full backup of your site first.

  1. Go to the WPMLSettings page and scroll to the Posts and Pages Synchronization section. Make sure that the Send to translation the content of raw HTML cells option is on.
  2. Create the file wp-content/mu-plugins/wpml-wpbakery-91-raw-html.php with this code:
PHP
<?php
/**
 * Plugin Name: WPML - keep WPBakery 9.1 Raw HTML in ATE translations
 * Description: Temporary workaround. Delete this file after you update WPML to a version that fixes the issue.
 */
add_filter(
    'content_save_pre',
    function ( $content ) {
        // WPML answers true only while it saves a translation from ATE,
        // and only when "Send to translation the content of raw HTML cells" is on.
        if ( ! apply_filters( 'wpml_pb_grant_unfiltered_html', false ) ) {
            return $content;
        }
        foreach ( $GLOBALS['wp_filter']['content_save_pre']->callbacks as $priority => $callbacks ) {
            foreach ( $callbacks as $callback ) {
                $function = $callback['function'];
                if ( is_array( $function ) && $function[0] instanceof Vc_Post_Admin && 'remove_custom_html' === $function[1] ) {
                    remove_filter( 'content_save_pre', $function, $priority );
                }
            }
        }
        return $content;
    },
    9
);

The code changes nothing when WPML is not saving a translation from ATE. When WPML saves a translation from ATE, it stops WPBakery from removing the Raw HTML elements and the buttons.

After you update WPML to the fixed version, delete the file.

Pages that were already translated stay broken. Update the translation in ATE again after you apply a workaround.

All known issues

Need Help with This Issue?

Ask a support question and we’ll look into it with you.