4

I found this thread here discussing this topic: https://stackoverflow.com/questions/14177844/how-to-change-form-action-url-for-contact-form-7

However it seems that using the following code does not work as the contact form is submitting with ajax back to CF7 and ignoring the post action.

add_filter('wpcf7_form_action_url', 'wpcf7_custom_form_action_url'); function wpcf7_custom_form_action_url(){ return 'www.myposthandler.com'; } 

Is there a way to disable the ajax submission?

Site where this is happening: https://daintreecapital.com.au/ the newsletter subscription form in the footer is what I am trying to alter.

3
  • BTW, don't you need to included the protocol on the return value (for those that are lurking)? As in return 'example.com/posthandler' ? Commented Jan 7, 2018 at 22:03
  • Yes, in use I put the actual handler there I just didn't want to post it on a public forum. Commented Jan 10, 2018 at 22:58
  • My point was that the return value should include the "https://" part (which actually doesn't appear in the comment, due to how this place formats links). Commented Jan 10, 2018 at 23:28

1 Answer 1

8

As per the CF7 Documentation, you can disable AJAX form submission by placing the following code in your wp-config.php

define('WPCF7_LOAD_JS', false); 
6
  • That disables ALL JS Commented May 25, 2018 at 2:12
  • @crmpicco It disables Contact Form 7's JS. Is there any other functionality of CF7 that depends on JS? Commented May 25, 2018 at 18:51
  • 3
    @Junaid field validation I guess. Commented Jan 10, 2019 at 14:05
  • @Fleuv IMHO, if CF7's JS is disabled, it'll take the input to the server, validate, return to the form and show the errors. So, we are not loosing any validation functionality. Commented Nov 5, 2019 at 14:03
  • How do you disable it only for a certain form? Commented Feb 1, 2020 at 11:12

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.