WordPress and special characters

Today when I was adding an article, I was getting really upset with WordPress, I just wanted to add some simple characters and have it printed AS IS.

When working with WordPress and using special characters like a redirection symbol ” > ”  or something enclosed in it’s on tag  like “<dev>” it will get hosed while editing in “HTML” mode. You could insert syntax to stop it from doing that, but it’s much easier to add a post with such things in “Visual” mode first. Then switch over to “HTML” mode if any other special tags are needed.

So simply switch to “Visual” mode and create your posts, then if you need/want, switch over to “HTML” mode and add your “<code> </code>” tags etc.

Additional Info:

To add a nice block surrounding your code like other sites do. You can add the following (when in “HTML” mode) to your code.

<pre style=”padding-left: 30px;”> your code or notes here </pre>

(You may need to adjust your”px” settings depending on the length)

Example:

Bookmark the permalink.

2 Comments

  1. If in Visual mode, you highlight the text you want to look like code, then use the “Format” dropdown and choose “preformatted”. The CSS will make a nice box around it and make it look like code on the web page once you have it published.

  2. Well, that works great for small items, but it screws some things up. So yeah, use the “preformatted” option, but if it acts a little strange you can try the other way as well.

Leave a Reply