Reset recaptcha contact form 7 [closed]

Since the recaptcha is created by contact form 7 without assigning the rendered recaptcha to a variable it was not possible to use grecaptcha.reset(opt_widget_id). Here is what is did: $(“.wpcf7-submit”).click(function(event) { var currentForm=$(this).closest(“form”); $( document ).ajaxComplete(function(event,request, settings) { var responseObj=JSON.parse(request.responseText); if(responseObj.mailSent==true){ //reset recaptcha var recaptchaIFrame=currentForm.find(“iframe”).eq(0); var recaptchaIFrameSrc=recaptchaIFrame.attr(“src”); recaptchaIFrame.attr(“src”,recaptchaIFrameSrc); } }); }); I have cleared the … Read more

How to add a custom tag in contact form 7 and change the output in email?

In the first step, the form to display, you can keep what you have coded. Then you can do that to generate the result in the e-mail : add_filter(“wpcf7_posted_data”, function ($posted_data) { $result = “”; foreach ($posted_data[“tag”] as $index => $question) { $answer = $posted_data[“ans”][$index]; $result .= “$question : $answer\n”; } $posted_data[“my_questions”] = $result; return … Read more

How to validate website field in contact form 7?

Yes, you can add your own custom validation. More info here. Here’s a working and tested example for your situation: Use [text* your-website] inside your contact form 7 form. Add this snippet to your theme’s functions.php, use a child-theme! add_filter( ‘wpcf7_validate_text*’, ‘custom_website_validation_filter’, 20, 2 ); function custom_website_validation_filter( $result, $tag ) { if ( $tag->name == … Read more

How to disable reCaptcha v3 except on Contact Form 7 pages?

I’d put the dequeue statements inside the ‘if’, replacing the $loadscripts line. No need to set the flag and then check the flag to dequeue. That might simplify the code for further debugging. Edited: suggested code corrections: function contactform_dequeue_scripts() { if (is_singular()) { $post = get_post(); if (has_shortcode($post->post_content, ‘contact-form-7’)) { wp_dequeue_script(‘contact-form-7’); wp_dequeue_script(‘google-recaptcha’); wp_dequeue_style(‘contact-form-7’); } } … Read more

Contact Form 7 to featured image

Thanks @Judd Franklin for the directions. I was also missing $submission->uploaded_files();. Here is the working code for those who are looking for the same answer: function image_form_to_featured_image( $contact_form ) { $submission = WPCF7_Submission::get_instance(); $posted_data = $submission->get_posted_data(); // Creating a new post with contact form values $args = array( ‘post_type’ => ‘projects’, ‘post_status’=> ‘draft’, ‘post_title’=> wp_strip_all_tags( … Read more