0

I'm trying to create a post on a WP 3.8 blog using the text editor that includes a <pre> tag with some JavaScript inside it. This JavaScript code happens to have a comment line that contains the string <html>. For some reason when I save a draft of the post, WP is adding </html> to the end of the code block right before the </pre>, right in the text editor.

I have the Crayon syntax highlighter installed, but it shouldn't come into play while I'm editing the post. It's almost like WP sees an open <html> tag and is proactively trying to close it. I also tried escaping the angle brackets but the preview of the post showed the actual &lt; and &gt;. I even tried putting the <html> string inside a <code> block inside the <pre>, but the extra </html> was still added.

Any idea why this is happening?

0

1 Answer 1

0

In the admin menu under Settings -> Writing, make sure the option to correct invalid XHTML is unchecked.

Ref: http://codex.wordpress.org/Settings_Writing_Screen

2
  • So what you are saying is that it is good practice to use invalid XHTML, just uncheck above mentioned box. Commented Mar 2, 2014 at 12:54
  • Please reread the question. The OP isn't using invalid code in a theme or plugin; code is being used inside a pre tag inside a post. Commented Mar 2, 2014 at 13:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.