I am new to wordpress and I just created a new blog(free version). Now It seems that code fromat doesn't work. All lines are aligned to the left. Please look at the image below.



1 Answer 1


You need to wrap your code in either code or pre tags. code is for when inline code in a sentence e.g. include("hello.php") whereas pre is for preformatted blocks of text e.g.:

function hello_world(){
    echo 'hello world';

For code highlighting etc, you'll need to look for plugins.

The easiest way of using these tags is using the preformatted style:

enter image description here

  • In HTML(not Visual), I added code tag but no luck.
    – Love
    Jul 6, 2012 at 14:59
  • 1
    That won't work, for example if I look at your screenshot I see you trying to use <code> for a block of code, which is not the correct usage at all. Reread my answer. Use <pre>
    – Tom J Nowell
    Jul 6, 2012 at 15:02
  • There is no pre tags on the menu, should I type in manually?
    – Love
    Jul 6, 2012 at 15:06
  • You can type it in manually, or in the styles dropdown, choose preformatted, see my answer for a screenshot
    – Tom J Nowell
    Jul 6, 2012 at 15:29
  • If I choice a plugin, how to? I downloaded one to my C drive, but where is the good place for it?
    – Love
    Jul 6, 2012 at 15:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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