WordPress.org

Support

Support » How-To and Troubleshooting » How to deal with hr horizontal rules – invalid code

How to deal with hr horizontal rules – invalid code

  • 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:

    text

    hr

    text

    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!

Viewing 4 replies - 1 through 4 (of 4 total)
  • 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.

    Moderator Andrew Ozz

    @azaozz

    WordPress Dev

    You can try this:
    http://www.urbangiraffe.com/plugins/disable-wpautop
    although it may break something else…

    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.

    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.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘How to deal with hr horizontal rules – invalid code’ is closed to new replies.