Opened 10 years ago
Closed 10 years ago
#30926 closed defect (bug) (duplicate)
]]> replaced with ]]> by the_content() not always desirable
Reported by: | jqz | Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | 4.1 |
Component: | Formatting | Keywords: | |
Focuses: | javascript | Cc: |
Description
Line 222 of wp-includes/post-template.php is the clear culprit:
$content = str_replace( ']]>', ']]>', $content );
This causes issues when such replacement is not desired, for example some generated Javascript to obfuscate an email address may result in this particular combination of characters within a string, and this str_replace will break it.
The combination marks the end of a CDATA section, and there was undoubtedly a reason for this line of code, but no comment is provided (is there a changelog description?), so it's not clear if it is still required. I note there is no corresponding code matching and replacing <![CDATA[ ...?
At a minimum, this string replacement should be done by a filter (priority 100+ to run last) so that it can be easily disabled if required. Any knowledge of why it exists should also be documented. If it can be safely removed entirely, so much the better.
Duplicate of #3670 and #27134.