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).
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.
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?
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.
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?
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)
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
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
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!
Manage Cookie Consent
We use cookies to optimize our website and services. Your consent allows us to process data such as browsing behavior. Not consenting may affect some features.
Functional
Always active
Required for our website to operate and communicate correctly.
Preferences
The technical storage or access is necessary for the legitimate purpose of storing preferences that are not requested by the subscriber or user.
Statistics
We use these to analyze the statistics of our site. Collected information is completely anonymous.The technical storage or access that is used exclusively for anonymous statistical purposes. Without a subpoena, voluntary compliance on the part of your Internet Service Provider, or additional records from a third party, information stored or retrieved for this purpose alone cannot usually be used to identify you.
Marketing
These cookies track your browsing to provide ads relevant to you.