In the file wp-includes\post-template.php, the function
After it calls
'the_content'filters, it runs the following code:
$content = str_replace(']]>', ']]>', $content);
I know this code has a reason to be there, but I google it everywhere and didn’t find it.
The problem I found is that, when a <script> code is added, we must put it inside CDATA tags so that XHTML validates it. And this code is breaking validation, since it removes CDATA closing tag.
And what’s “funny” is that filters call is just above it and even so it is hardcoded, we can’t remove it using the hook system, being forced to hack the core.
Does anybody know why that replacement is done in the_content? And how to surpass it and be able to add valid scripts into our posts?