Skip Navigation

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

Problem:
If you're trying to use the automatic translation to translate your website into French and you notice that HTML entities like apostrophes are displaying incorrectly (e.g., '@apos;') within the Divi accordion toggle.
Solution:
We recommend adding the following custom PHP code to your theme's functions.php file or a site-specific plugin:

// WPML workaround for compsupp-7001<br />add_filter('do_shortcode_tag', 'wpml_compsupp7001_decode_et_pb_button_text', 10, 4);<br />  <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 />        // Decode both the ampersand and the apostrophe<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 />        // Decode both the ampersand and the apostrophe<br />        $output = html_entity_decode($output, ENT_QUOTES, 'UTF-8');<br />    }<br />    <br />    return $output;<br />}<br />

This code should resolve the issue by decoding HTML entities for the button text and accordion item titles.

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

0% of people find this useful.

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 4 replies, has 2 voices.

Last updated by Kor 1 year, 4 months ago.

Assisted by: Kor.

Author Posts
January 29, 2024 at 4:12 pm #15239742

caitlinC-2

I am trying to: Use the automatic translation to translate the website to french, however, it is displaying in HTML on the Divi accordion toggle.

Link to a page where the issue can be seen: You can view the issue under the FAQ section - hidden link

I expected to see: an apostrophe

Instead, I got: @apos;

January 29, 2024 at 8:21 pm #15240631

Kor
WPML Supporter since 08/2022

Languages: English (English )

Timezone: Asia/Singapore (GMT+08:00)

Hi there,

Thanks for contacting WPML support.

I will need to closely examine your website. Therefore, I will require temporary access (WP-Admin and FTP) to a test site where the problem has been replicated, if possible. This will enable me to provide better assistance and determine if any configurations need to be modified.

Please note that it is important to have a backup for security purposes and to prevent any potential data loss. You can use the UpdraftPlus plugin (https://wordpress.org/plugins/updraftplus/) to fulfill your backup requirements.

Your upcoming reply will be treated with confidentiality and will only be visible to you and me.

✙ To resolve the issue, I may need your consent to deactivate and reactivate plugins and the theme, as well as make configuration changes on the site if necessary. This emphasizes the significance of having a backup.

Upon reviewing your debug information, I have observed that the PHP limit for your "WP Memory Limit" is lower than the recommended 256MB or the required 128MB, as mentioned in the documentation found at: https://wpml.org/home/minimum-requirements/. To resolve this, I kindly request that you contact your hosting provider and request an increase in the PHP value for you.

January 30, 2024 at 2:15 pm #15244264

Kor
WPML Supporter since 08/2022

Languages: English (English )

Timezone: Asia/Singapore (GMT+08:00)

Thanks for your reply.

Could you please try using the workaround here https://wpml.org/errata/divi-button-apostrophes-display-as-html-entities/ and see if it helps?

January 30, 2024 at 2:20 pm #15244295

caitlinC-2

I did try that and it didn't work.

January 30, 2024 at 2:41 pm #15244529

Kor
WPML Supporter since 08/2022

Languages: English (English )

Timezone: Asia/Singapore (GMT+08:00)

Thanks for your patience.

I've added the custom PHP code below and it should work now.

// 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');
    }
	
  
    return $output;
}
January 30, 2024 at 3:23 pm #15244959

caitlinC-2

Thank you!!!