Skip to content

Instantly share code, notes, and snippets.

@petertwise
Last active March 1, 2018 18:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save petertwise/7d0ebe2985ef6f6ac7dbfa70606f2722 to your computer and use it in GitHub Desktop.
Save petertwise/7d0ebe2985ef6f6ac7dbfa70606f2722 to your computer and use it in GitHub Desktop.
Contact Form 7 - thank you page per form
document.addEventListener( 'wpcf7mailsent', function(event) {
// console.log(event.detail.contactFormId, event);
switch( event.detail.contactFormId ) {
case "1234":
// thank you page for form ID 1234 "My Form 1"
location='https://example.com/form1/thank-you/';
break;
case "1235":
// thank you page for form ID 1235 "My Form 2"
location='https://example.com/form2/thank-you/';
break;
default:
// default thank you page for all other forms
location='https://example.com/thank-you/';
break;
}
}, false );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment