WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Pre-formatted text in the Visual Editor is not behaving like I'm used to. I've got an old installation (3.2.1), and when create pre-formatted text, all the line-breaks and spacing is preserved. In the latest version (3.3.1), the line breaks are interpreted as new paragraphs, and the code is broken across those paragraphs, leading spaces removed.


  1. Copy code from text editor.
  2. Click on the "New Post" link.
  3. Choose "Preformatted" from the format menu.
  4. Paste (ctrl-v).

3.2.1 - Correctly formatted code

screenshot of correctly formatted code

3.3.1 - Incorrectly formatted code

screenshot of incorrectly formatted code

I know I can switch to code view and put tags in myself, but I'm not looking for a workaround.

share|improve this question

When you paste your code, TinyMCE (the visual editor) automatically switches back to paragraph mode because that's the default for the editor. You have to highlight you pasted code and re-select "preformatted" to get it to be tagged correctly.

Also, TinyMCE always closes tags when you press enter. If you want to go to a new line without closing a tag, press shift + enter instead.

share|improve this answer
If I paste the code in first, I lose all my indentation. The previous version of WordPress allowed me to select preformatted before I pasted. – Matt Feb 10 '12 at 19:28

I didn't have any luck with changing format to/from/back-to "preformatted" after pasting the text. What does work for me (on windows in firefox) is pasting the text with Ctrl-Shift-V rather than Ctrl-V. Now my leading code-indentation spaces are preserved after pasting text. I haven't tried this in other browsers.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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