Skip Navigation

This thread is resolved. Here is a description of the problem and solution.

Problem:
After installing WPML on a WordPress site using the Divi theme, the client is unable to use the translation management view to automatically translate content, as page created with Divi have a lot of content global_colors_info.

Solution:
We recommend the following workaround:
1. Backup the website or create a backup of the problematic page.
2. Add the following code to the

functions.php

file of your theme:

// WPML Workaround for compsupp-7144
function wpml_compsupp7144_clear_global_colors_info_attribute($post_id) {
    $post_content = get_post_field('post_content', $post_id);
    $pattern = '/(\[.*?global_colors_info=")([^\"]*)(\"[^\]]*\])/'
    $new_content = preg_replace_callback(
        $pattern,
        function ($matches) {
            return $matches[1] . '' . $matches[3];
        },
        $post_content
    );
    if ($new_content !== $post_content) {
        $updated_post = array(
            'ID'           => $post_id,
            'post_content' => $new_content,
        );
        wp_update_post($updated_post);
    }
}
wpml_compsupp7144_clear_global_colors_info_attribute(999999); // Replace 999999 with your post ID

3. Replace

999999

with the post ID of the page you're having issues with.
4. Visit the page on the front-end to execute the code.
5. Comment out the last line of the snippet after the code has run.
This will remove the content of all

global_colors_info

attributes from the page, allowing you to translate the page using the Classic Translation Editor (CTE) or Advanced Translation Editor (ATE).

If this solution doesn't seem relevant to your issue, please open a new support ticket with us.

This is the technical support forum for WPML - the multilingual WordPress plugin.

Everyone can read, but only WPML clients can post here. WPML team is replying on the forum 6 days per week, 22 hours per day.

Tagged: 

This topic contains 14 replies, has 2 voices.

Last updated by Dražen 1 year, 4 months ago.

Assisted by: Dražen.

Author Posts
January 11, 2024 at 12:31 pm

jonathanK-23

We just installed WPML on our WordPress site that used Divi theme. I'm having some problem using the translation management view to automatically translate content. I have to edit each individual page to add each language.

January 11, 2024 at 1:17 pm
January 11, 2024 at 1:19 pm #15174736

Dražen
Supporter

Languages: English (English )

Timezone: Europe/Zagreb (GMT+02:00)

Hello,

I moved the chat to the ticket.

1) Please let me know if it is okay to switch themes and disable plugins?

2) I would need FTP access also, as seems something is blocking WPML, at least what I suspect.

Regards,
Drazen

January 11, 2024 at 1:27 pm
January 11, 2024 at 1:39 pm #15174872

Dražen
Supporter

Languages: English (English )

Timezone: Europe/Zagreb (GMT+02:00)

Hello,

thanks, I checked further and can see next error in debug log

PHP Warning:  preg_replace(): Compilation failed: regular expression is too large at offset 766175 in /home/952279.cloudwaysapps.com/asrjqgjcxv/public_html/wp-content/plugins/sitepress-multilingual-cms/addons/wpml-page-builders/classes/Shared/st/strategy/shortcode/class-wpml-pb-update-shortcodes-in-content.php on line 126

I am not sure if it is something related to your server, so I would like to take a copy and test on or side. Is that okay and do we have permission to take a copy?

Thanks,
Drazen

January 11, 2024 at 2:20 pm #15175054

jonathanK-23

Yes, you can copy the site. Please note that its hosted on Cloudways and is a "staging site".

Could you also change so the email notices when the ticket is updated come to my email: sebastian@webhorisont.se instead? Now they are going to my client.

January 11, 2024 at 2:45 pm #15175249

Dražen
Supporter

Languages: English (English )

Timezone: Europe/Zagreb (GMT+02:00)

Hello,

thanks, I will start the process and update you tomorrow.

I can not change your email, you need to go to your account details and change the email from there.

Regards,
Drazen

January 12, 2024 at 7:49 am #15177438

Dražen
Supporter

Languages: English (English )

Timezone: Europe/Zagreb (GMT+02:00)

Hello,

thanks for your patience.

I have tried and the same issue happens for the homepage, but it seems to work for other pages normally.

- hidden link

I have escalated the case to our 2nd tier to check further on why the homepage translation is not working.

I will update you soon.

Regards,
Drazen

January 12, 2024 at 2:33 pm #15179626

Dražen
Supporter

Languages: English (English )

Timezone: Europe/Zagreb (GMT+02:00)

Hello,

we checked further and it seems to be related to the size of the page, for the homepage, you have a lot of information inside global_colors_info attribute.

If I delete these attributes and re-translate the page it saves fine. The image is attached for better understanding.

1) Can you share more info on how this option or attribute is set and is used for?

2) Can you please try to go to the next page and create this same widget as in the image shared on one example page to see if the same issue happens?

Link: hidden link

Thanks,
Drazen

Screenshot_2.jpg
January 16, 2024 at 8:57 am #15188435

jonathanK-23

Hello Drazen,

Trying to answer you below:

1.) I am not aware what is going on with the button and global_colors_info. Can you determine which module is outputting what you posted in your screenshot? I'm not sure which one it is?

2.) You have shared 10 screenshots of some code. Was that intentional?

Looking at the image, I think it might be the module I included in the screenshot below? (blue circle around it)

example.jpg
January 16, 2024 at 10:23 am #15188972

Dražen
Supporter

Languages: English (English )

Timezone: Europe/Zagreb (GMT+02:00)

Hello,

I can see the screenshot only shared 1 time from my side.

As for the issue, we will try to check further on this and contact Divi authors to help out.

As a workaround for this page, you can use the next workaround:

- Switch to the 2021 theme and install the Classic editor plugin
- Edit your page and copy shortcode content
- Paste to Notepad or some code editor
- Replace / empty global color content so that it looks

global_colors_info="{}"

- Copy back to your page
- Disable the Classic editor plugin and switch back to Divi
- Save and translate
- It works fine

Let me know how it goes.

Regards,
Drazen

January 18, 2024 at 9:29 am #15198860

Dražen
Supporter

Languages: English (English )

Timezone: Europe/Zagreb (GMT+02:00)

Hello,

can you please install/update Divi to the latest version 4.23.4 on our test site:

- hidden link

It would be also a good idea to contact Divi support and share this with them, as we are not able to reproduce the issue and it looks like a bug, as your page content should not look like that. Basically without that additional content page size is 112KB and with it 3.50MB

Thanks,
Drazen

January 18, 2024 at 2:33 pm #15200598

jonathanK-23

Hello Drazen, that sure sounds like a bug.

Trying to find our credentials for Divi, will get back to you when its installed

January 18, 2024 at 3:01 pm #15200822

jonathanK-23

Hello, I've updated Divi on your test-site now

January 18, 2024 at 3:40 pm #15200999

jonathanK-23

I followed your instructions for removing the strange "global colors" and now the translations are working as expected.

I'll send a copy of this to Divi at some point to let them know about this issue.

Will do a bit more testing and will create a new ticket if I run into any problems!

Thanks for the great help!