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)