• Resolved Sprul66

    (@sprul66)


    Is there a filter function or hook to remove the automaticly inserted “size” attribute?

    This is what I get:
    <span class=”wpcf7-form-control-wrap firstname”><input type=”text” name=”firstname” value=”” size=”40″ class=”wpcf7-form-control wpcf7-text wpcf7-validates-as-required half” aria-required=”true” aria-invalid=”false” placeholder=”Vorname”></span>

    This is what i would like to get:
    <span class=”wpcf7-form-control-wrap firstname”><input type=”text” name=”firstname” value=”” class=”wpcf7-form-control wpcf7-text wpcf7-validates-as-required half” aria-required=”true” aria-invalid=”false” placeholder=”Vorname”></span>

    Another question:
    Is there a hook to add the input class to the wrapper span?

    Thanks in advance!

Viewing 1 replies (of 1 total)
  • Thread Starter Sprul66

    (@sprul66)

    Here is the answer to my own question. But this doesnt helped me out with my main problem (percentage width on the input or wrapper tag). Anyway, just replace size=”100″ with whatever you need:

    add_filter( 'wpcf7_form_elements', 'remove_attr_size' );
    	function remove_attr_size( $content ) {
    		$content = preg_replace('/ size=".*?"/i', ' size="100"', $content);
    		return $content;
    	}
    • This reply was modified 7 years, 11 months ago by Sprul66.
Viewing 1 replies (of 1 total)
  • The topic ‘Remove size attribute from input fields’ is closed to new replies.