Skip Navigation

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

Problem:
When updating translations, all apostrophes in Divi Toggle module titles are incorrectly replaced with triple apostrophes across the entire page, not just the edited content. The existing workaround in functions.php from WPML support pages is not resolving the issue.
Solution:
If you're experiencing this issue, we recommend updating your functions.php file with the following code to correctly decode special characters like apostrophes and ampersands in Divi module titles:

// WPML workaround for compsupp-7001<br />add_filter('do_shortcode_tag', 'wpml_compsupp7001_decode_et_pb_button_text', 10, 4);<br />function wpml_compsupp7001_decode_et_pb_button_text($output, $tag, $attr, $m) {<br />    if (class_exists('Sitepress') && 'et_pb_button' === $tag && isset($attr['button_text'])) {<br />        $output = html_entity_decode($output, ENT_QUOTES, 'UTF-8');<br />    }<br />    if (class_exists('Sitepress') && 'et_pb_accordion_item' === $tag && isset($attr['title'])) {<br />        $output = html_entity_decode($output, ENT_QUOTES, 'UTF-8');<br />    }<br />    if (class_exists('Sitepress') && 'et_pb_toggle' === $tag && isset($attr['title'])) {<br />        $output = html_entity_decode($output, ENT_QUOTES, 'UTF-8');<br />    }<br />    return $output;<br />}

Please note that this solution might be outdated or not applicable to your specific case. We highly recommend checking related known issues at https://wpml.org/known-issues/, verifying the version of the permanent fix, and confirming that you have installed the latest versions of themes and plugins. If the issue persists, please open a new support ticket at WPML support forum for further assistance.

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.

Our next available supporter will start replying to tickets in about 1.69 hours from now. Thank you for your understanding.

This topic contains 3 replies, has 2 voices.

Last updated by aleksandraG-2 1 month, 2 weeks ago.

Assisted by: Bobby.

Author Posts
July 17, 2024 at 1:39 pm #15966596

aleksandraG-2

Background of the issue:
Whenever a translation update takes place, all apostrophes in toggle titles get replaced with ''' instead (across the entire page, not just edited content. I have added the functions.php snippet that was in the WPML support pages from 2022 but it's not resolving the issue. Please help!

Symptoms:
language editor displays text correctly as per input (an apostrophe), front end replaces these with ''' in all Divi Toggle module titles.

Questions:
I need a fix for this please.

July 17, 2024 at 1:42 pm #15966616

aleksandraG-2

I have added the PHP to my functions file as per
https://wpml.org/forums/topic/divi-toggle-apostrophes-display-as-html/

I also added a new class to cover Divi Toggles -
if ( class_exists('Sitepress') && 'et_pb_toggle_item' === $tag && isset($attr['title'])) {
// Decode both the ampersand and the apostrophe
$output = html_entity_decode($output, ENT_QUOTES, 'UTF-8');

This has not resolved the issue - I need further assistance please

July 17, 2024 at 6:11 pm #15967860

Bobby
Supporter

Languages: English (English )

Timezone: America/Los_Angeles (GMT-07:00)

I would like to request temporary access (wp-admin and FTP) to your site to test the issue.
(preferably to a test site where the problem has been replicated if possible)

**Before we proceed It is necessary to take FULL BACKUP of your database and your website. Providing us with access, you agree that a backup has been taken **

I often use the Duplicator plugin for this purpose: http://wordpress.org/plugins/duplicator/
You will find the needed fields for this below the comment area when you log in to leave your next reply.
The information you enter is private which means only you and I have access to it.

NOTE: If access to the live site is not possible and the staging site does not exist please provide me with a duplicator package created with the duplicator plugin.

Thank you,
Bobby

July 24, 2024 at 2:19 pm #15998916

aleksandraG-2

I wanted to add a note on the solution - I identified the proper class to resolve the issue myself, and in case anyone else can benefit from the solution, the code that I used in functions.php is as follows:

/* ---------------------- Your code goes below ---------------------- */
// WPML workaround for compsupp-7001
add_filter('do_shortcode_tag', 'wpml_compsupp7001_decode_et_pb_button_text', 10, 4);

function wpml_compsupp7001_decode_et_pb_button_text($output, $tag, $attr, $m) {
if ( class_exists('Sitepress') && 'et_pb_button' === $tag && isset($attr['button_text'])) {
// Decode both the ampersand and the apostrophe
$output = html_entity_decode($output, ENT_QUOTES, 'UTF-8');
}
if ( class_exists('Sitepress') && 'et_pb_accordion_item' === $tag && isset($attr['title'])) {
// Decode both the ampersand and the apostrophe
$output = html_entity_decode($output, ENT_QUOTES, 'UTF-8');
}

if ( class_exists('Sitepress') && 'et_pb_toggle' === $tag && isset($attr['title'])) {
// Decode both the ampersand and the apostrophe
$output = html_entity_decode($output, ENT_QUOTES, 'UTF-8');
}

return $output;
}

July 24, 2024 at 2:20 pm #15998947

aleksandraG-2

Please note it would be great to see this issue permanently addressed by the dev team - the workaround for functions.php has been issued a couple years ago and this problem still persists in a number of builder modules (buttons, toggles, etc)

aleksandraG-2 confirmed that the issue was resolved on 2024-07-24 14:20:53.
This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.