Add custom variable in Contact Form 7 mail body

You should do it like so: add_action( ‘wpcf7_init’, ‘custom_add_form_tag_my_source’ ); function custom_add_form_tag_my_source() { // “my-source” is the type of the form-tag wpcf7_add_form_tag( ‘my-source’, ‘custom_my_source_form_tag_handler’ ); } function custom_my_source_form_tag_handler( $tag ) { return isset( $_COOKIE[‘my_source’] ) ? $_COOKIE[‘my_source’] : ”; } See the documentation for more details. Or you can also try this, to parse regular … Read more

How to set Contact Form 7 fields default value using shortcode attribute? [closed]

the destination-email attribute requires an additional filter to be hooked to work, as detailed in cf7 doc and this forum thread, you need to ensure you do the following 4 steps: 1) in addition to the short code attribute, [contact-form-7 id=”123″ title=”Contact Form” destination-email=”[email protected]”] 2) you need to, add_filter( ‘shortcode_atts_wpcf7’, ‘custom_shortcode_atts_wpcf7_filter’, 10, 3 ); function … Read more

get values from contact form 7 wp plugin [closed]

First change the `on_sent_ok’ to: on_sent_ok: ‘my_redirect();’ then create that my_redirect() function in the page that displays the form: <script> function my_redirect() { var price = document.getElementById(‘PRICE_FIELD’).value; var url=”https://www.sandbox.paypal.com/us/cgi-bin/webscr?cmd=_xclick&[email protected]&currency_code=USD&amount=”+price+’&return=http://http://cratecreative.com/norpac&item_name=contribution’; window.location = url; } </script and done! Just make sure that you correct the email in that url and replace PRICE_FIELD with the actual id of … Read more

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

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)