Title: Display error fields without span wrapper
Last modified: July 28, 2017

---

# Display error fields without span wrapper

 *  [topitoconnectey](https://wordpress.org/support/users/topitoconnectey/)
 * (@topitoconnectey)
 * [8 years, 8 months ago](https://wordpress.org/support/topic/display-error-fields-without-span-wrapper/)
 * Hi,
    For my website style’s sake, I disabled the span wrapper on contact form
   7 inputs, using this code in functions.php (found on stackoverflow). It works
   and deletes the span wrapper
 *     ```
       add_filter('wpcf7_form_elements', function($content) {
           $content = preg_replace('/<(span).*?class="\s*(?:.*\s)?wpcf7-form-control-wrap(?:\s[^"]+)?\s*"[^\>]*>(.*)<\/\1>/i', '\2', $content);
   
           return $content;
       }); 
       ```
   
 * The problem is that CF7’s JS seems to use this unwanted span wrapper to display
   error fields, as they have now disappeared on my site.
    Is there a way to display
   them without bringing back the style wrapper ? (which would break my CSS only
   floating labels)

The topic ‘Display error fields without span wrapper’ is closed to new replies.

 * ![](https://ps.w.org/contact-form-7/assets/icon.svg?rev=2339255)
 * [Contact Form 7](https://wordpress.org/plugins/contact-form-7/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/contact-form-7/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/contact-form-7/)
 * [Active Topics](https://wordpress.org/support/plugin/contact-form-7/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/contact-form-7/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/contact-form-7/reviews/)

## Tags

 * [error messages](https://wordpress.org/support/topic-tag/error-messages/)
 * [js](https://wordpress.org/support/topic-tag/js/)
 * [php](https://wordpress.org/support/topic-tag/php/)

 * 0 replies
 * 1 participant
 * Last reply from: [topitoconnectey](https://wordpress.org/support/users/topitoconnectey/)
 * Last activity: [8 years, 8 months ago](https://wordpress.org/support/topic/display-error-fields-without-span-wrapper/)
 * Status: not resolved