In Contact Form 7, in the "Other settings" of the editing screen for each form on the management screen,
on_sent_ok: "window.location.href='Redirect to URL';"
After the Contact Form 7 process is completed, it will redirect you to the URL you set.
However, if you set this up, you will be redirected to the same URL whether it succeeds or fails, so you don't know if the sending was successful or failed.
If you want to display a message instead of a screen transition, the message is switched between success and failure, and JavaScript should be used to process it.
Therefore, we will modify the js file of Contact Form 7 to redirect it to the error redirect URL in case of error.
/pm_webform/wp-content/plugins/contact-form-7/includes/js scripts.js
The following lines near line 67
} else {
You can add the following line below to redirect to the redirect URL for failure.
window.location.href = "Redirect URL for failure";
Similarly, the following line near line 57
} else if (1 == data.mailSent) {
You can add the following line below to redirect to the redirect URL for success.
window.location.href = "redirect URL on success";