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.

  • BTW, don't you need to included the protocol on the return value (for those that are lurking)? As in return 'example.com/posthandler' ? – Rick Hellewell Jan 7 '18 at 22:03
  • Yes, in use I put the actual handler there I just didn't want to post it on a public forum. – benikens Jan 10 '18 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). – Rick Hellewell Jan 10 '18 at 23:28

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);
  • That disables ALL JS – crmpicco May 25 '18 at 2:12
  • @crmpicco It disables Contact Form 7's JS. Is there any other functionality of CF7 that depends on JS? – Junaid May 25 '18 at 18:51
  • 3
    @Junaid field validation I guess. – luukvhoudt Jan 10 '19 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. – Junaid Nov 5 '19 at 14:03
  • How do you disable it only for a certain form? – Andrei F Feb 1 '20 at 11:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.