Skip Navigation

Resolved

Overview of the issue

Translating Avia Layout Builder pages (included in Enfold theme) isn’t working correctly when we use the advanced layout editor.

Workaround

Adding this snippet to functions.php in your theme will make sure that the internal data is synchronized correctly when adding translations with the translation editor.

add_action( 'wpml_translation_job_saved', '_sync_avia_layout_builder', 10, 3 );
function _sync_avia_layout_builder( $new_post_id, $fields, $job ) {
    if ( isset( $fields['body']['data'] ) ) {
        if ( 'active' === get_post_meta( $new_post_id, '_aviaLayoutBuilder_active', true ) ) {
            update_post_meta(
                $new_post_id,
                '_aviaLayoutBuilderCleanData',
                $fields['body']['data']
            );
        }
    }
}