Required checkbox with CF7 only for one form
-
Hello,
Is it possible to make MC4WP consent checkbox required, ONLY for one form?
I found and used the code in the support ticket bellow, but this code adds the requirement to all the Contact Forms, even if they don’t have inside them [mc4wp_checkbox] shortcode.
Thank you in advance.
Dimishttps://wordpress.org/support/topic/required-checkbox-with-cf7/
/** * By default, Contact Form 7 disables HTML5 validation so we can not use the default <code>required</code> attribute. * * This code uses CF7 logic to ensure that the subscribe checkbox is checked. */ add_filter( 'wpcf7_acceptance', function( $yes ) { if( ! $yes ) { return false; } return ! empty( $_POST['_mc4wp_subscribe_contact-form-7'] ); });
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘Required checkbox with CF7 only for one form’ is closed to new replies.