How to deal with hr horizontal rules - invalid code (5 posts)

  1. jeff_n
    Posted 9 years ago #

    When I place an hr in my code, it doesn't validate. The problem is that WordPress automatically wraps it in paragraph tags, which is to my understanding invalid.

    For example I have this in my entry:




    and it does this:

    p text p

    p hr p

    p text p

    Are there any workarounds for this? Or plugins to deal with how WordPress interprets the entry text (so that it doesn't automatically wrap hr with p tags)?

    Thanks in advance!

  2. Jonathan Landrum
    Posted 9 years ago #

    Yeah, but it depends on how confident you feel working in phpMyAdmin.

    As far as making WP do what you tell it to, probably not. At least, not in the foreseeable future.

  3. Andrew Ozz
    WordPress Dev
    Posted 9 years ago #

    You can try this:
    although it may break something else...

  4. jeff_n
    Posted 9 years ago #

    Thanks...I'll try that plugin. If it doesn't work I think I may just accept that the site doesn't validate, cause it seems rather silly to me.

  5. I made a quick test, and it's definitely wpautop adding those incorrect p's.

    You can edit the wpautop function in formatting.php. I think that adding "hr" to the big list in $allblocks would solve the issue, but I'm not sure of that.

    I've logged a bug into trac about it, so there may be a fix in future versions.

Topic Closed

This topic has been closed to new replies.

About this Topic