Support » Fixing WordPress » [Plugin: Contact Form 7] Contact form and WordPress adding <p> tags

  • Hi, this contact form plugin works fine for me. I just have a issue of my page being validated. The beginning of the contact form code starts with a <div> tag. Thanks for WP’s annoying feature of adding <p> where I don’t want them, it adds a <p> before that <div> and thus results in a validation error. Does anyone know how to turn this stupid feature off? I’ve already looked into turning off the wautop function in the default-filters.php file and that hasn’t stopped the <p> adding. My page with the contact form plugin used is here:

Viewing 4 replies - 1 through 4 (of 4 total)
  • I don’t think that the contact form is adding this <p> tag. It may be coming from your template or the enclosing post’s content. I’ve used Contact Form 7 many times and I’ve never had this problem. and, yes, I do validate all pages so I know I’ve not had an issue with an unclosed p tag.

    Same problem here.

    • I’m using Contact Form 7 in a WordPress Page,
    • its content is only the [contact-form …] tag.
    • My contact-form starts with a <label> tag (no blank-spaces before).

    Contact Form 7 is adding its form tag and wrappers, and then a <p> tag (which never closes), and then my first <label>… resulting in validation error.

    Any workaround?

    Place each label/input pair in a set of <p></p> tags? Or enclose all label/inputs inside the form within a set of <p></p> tags.

    Thank you, the workaround worked.

    But I still consider this behavior a bug, some people would like to use:

      <dt><label for="...">Label</label></dt>
      <dd><input id="..." name="..." type="text"/></dd>

    which is easily stylable, and could be semantic in some context.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘[Plugin: Contact Form 7] Contact form and WordPress adding <p> tags’ is closed to new replies.