I’m facing an issue with the wp_editor (TinyMCE) in WordPress 6.5.3 (latest) where the quotes in my content are being replaced incorrectly. I’m using a custom shortcode (handled by WPCode) to display an editable content area on a post, but when the content is loaded into the editor, the double quotes (“) are being replaced with “ entities, causing display issues.
Code snippet:
<?php
wp_editor($editable_content, 'post_content', [
'textarea_name' => 'post_content',
'textarea_rows' => 20,
]);
//error_log($editable_content);
?>
Example:
<img src="https://upload.wikimedia.org/wikipedia/commons/2/22/L%C3%B6we_1.jpg" alt="" />
is displayed (not stored) as:
<img src=“https://upload.wikimedia.org/wikipedia/commons/2/22/L%C3%B6we_1.jpg“ alt=““ />
and after using the visual editor:
<img src="“https://upload.wikimedia.org/wikipedia/commons/2/22/L%C3%B6we_1.jpg“" alt="““" />
I have already tried the following approaches to resolve the issue, but none of them worked:
-
Using the remove_filter function to remove wptexturize or wp_filter_post_kses
-
Modifying the TinyMCE settings
The issue persists, and the quotes are still being replaced incorrectly in the editor. It’s possible that I’m not using the remove_filter function correctly before calling wp_editor.
I’ve also ensured that the $editable_content variable contains the correct content before passing it to wp_editor.
I have been facing the problem for more than a day now, I would appreciate your help.
If you need any additional information, please let me know.
hobbycode is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.