The contact-form-7 wpcf7 form name attr hook.
Published Date - July 22, 2023
$name_attr = apply_filters( 'wpcf7_form_name_attr',
preg_replace( '/[^A-Za-z0-9:._-]/', '', $args['html_name'] )
);
$preg_replace
The following example is for adding a hook callback.
// define the wpcf7_form_name_attr callback
function custom_wpcf7_form_name_attr( $preg_replace ){
//custom code here
return $preg_replace
}
//add the action
add_filter('wpcf7_form_name_attr', 'custom_wpcf7_form_name_attr', 10, 1)
The filter is defined in the following location(s).
contact-form-7/includes/contact-form.php
$name_attr = apply_filters( 'wpcf7_form_name_attr',
preg_replace( '/[^A-Za-z0-9:._-]/', '', $args['html_name'] )
);