MAX POWER
MAX POWER

Reputation: 5448

Wordpress formatting CODE tag with P tags

I'm using WordPress v 4.0

I've just created a new post, which contains a code block. This code block also contains some empty lines. I have used the "code" button on the in-built editor to enclose the entire code block in to a CODE tag.

The problem is, on my front end output, this CODE tag is being split up and enclosed in P tags. Here is the output I get for the block:

<div class="entry-content">
    <p>
         <code>some code</code>
    </p>

    <code>
         <p>some code</p>
    </code>

     <p>
         <code>some code</code>
     </p>
</div>

This means I can't efficiently style the code block. I'd like to display the code block in a grey background.

Anybody have any ideas how to stop WP from formatting the block this way?

Upvotes: 0

Views: 56

Answers (1)

Fatih SARI
Fatih SARI

Reputation: 433

You must prepare your post with visual post editor and save when it is visual. Now, WP'll convert '<' and '>' to &lt; and &gt;

Upvotes: 1

Related Questions