Support » Fixing WordPress » 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:




    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.

    Andrew Ozz


    WordPress Dev

    You can try this:
    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.

    Moderator Samuel Wood (Otto)

    (@otto42) Admin

    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.