Made by Nathan

programming and projects

How to Preserve Indentation in Wordpress [Sourcecode] Tags

| Comments

Dont use the visual editor. Copy the code into your ‘HTML’ view and it will preserve indentation. Copy it into ‘Visual’ view and your code will be all left-aligned…

Examples:

Code pasted in ‘Visual’ View

<indent>
<indent>
<indent>
</indent>
</indent>
</indent>

Code pasted in ‘HTML’ View

<indent>
    <indent>
        <indent>
        </indent>
    </indent>
</indent>

YMMV, I guess, but this is what works for me.

Comments