Forum Replies Created

Viewing 1 replies (of 1 total)
  • Hi! You can use this code I wrote. Is kinda hacky but is better than
    hacking the plugin core code or rely on javascript tricks. Hope someone find this useful.

    function cfvalues( $a ) {
    	$field_name = 'subject';
    	$default_value = 'custom';
    	if ( preg_match_all( '/<input.*?name="' . $field_name . '".*?\/>/', $a, $match ) ) {
    		$subject = $match[ 0 ][ 0 ];
    		$new_subject = preg_replace( '/value=""/', 'value="' . $default_value . '"', $subject );
    		$a = str_replace( $subject, $new_subject, $a );
    	}
    	return $a;
    }
    add_filter( 'wpcf7_form_elements', 'cfvalues' );
Viewing 1 replies (of 1 total)