Get help. Give help. A Web Design and Development Community.

Stop WordPress rendering markup inside pre tags

  • # February 7, 2012 at 5:45 pm

    G’day guys. This is most likely a simple fix, but how do you stop WordPress from rendering elements inside pre tags? I currently have a plugin installed that is meant to do exactly that (which it does not).

    There are two issues. The first is that I don’t want to have to use the HTML entity for <. The second occurs whenever I edit a previous post that has HTML wrapped in pre tags: line breaks magically appear. WordPress must have a default method of formatting markup, which I would love to turn off.

    # February 8, 2012 at 5:03 pm

    @chriscoyier Would you mind sharing what you use to stop WordPress messing about with the stuff in-between pre tags?

    # February 8, 2012 at 7:48 pm

    After continued searching, and trailing, this plugin currently escapes html entities for me:

    Still having problems with they way WordPress formats my code though. For instance, I paste in this:


    That will work fine for the first time. If I am to go back and edit the post at a later date though, this is what I get:




    If anyone else is even experiencing the same thing, please speak up so I know it’s not just me.

    # March 6, 2012 at 2:31 am


    # March 6, 2012 at 3:40 am

    This reply has been reported for inappropriate content.

    I think for wordpress you need to use

    # March 6, 2012 at 3:59 am

    I’ll have a play around with that. Thanks for the reply Karl.

    # March 6, 2012 at 4:18 am

    This reply has been reported for inappropriate content.

    I think the pre keeps the formatting and the code does the escaping

Viewing 7 posts - 1 through 7 (of 7 total)

You must be logged in to reply to this topic.

We have a pretty good* newsletter.