This thread is resolved. Here is a description of the problem and solution.
Problem:
If you're experiencing issues where the
<source>
and
<target>
tags in your XLIFF file show empty CDATA[] instead of the actual text, this might be due to an issue with HTML sanitization in your theme's code.
Solution:
We recommend modifying the
wp_kses_allowed_html
filter in your theme. Specifically, avoid using a wildcard for attributes and instead, explicitly apply the
style
attribute to each allowed tag. Here is a corrected version of the code you can use:
add_filter('wp_kses_allowed_html', function($allowed, $context) { if ($context === 'post') { if (!isset($allowed['script'])) { $allowed['script'] = array(); } $allowed['script'] = array_merge($allowed['script'], array( 'src' => true, 'type' => true, 'charset' => true, 'data-*' => true, 'defer' => true, 'async' => true, )); if (!isset($allowed['style'])) { $allowed['style'] = array(); } $allowed['style'] = array_merge($allowed['style'], array( 'type' => true, 'media' => true, 'scoped' => true, )); // Properly allow inline styles on a per-tag basis foreach ($allowed as $tag => &$attributes) { if (is_array($attributes)) { $attributes['style'] = true; } } } return $allowed; }, 10, 2);
Please try this solution and let us know if it resolves the issue.
If this solution does not apply to your case, or if it seems outdated, 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 problem persists, please open a new support ticket.
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.