Post

Contact Form 7 Redirection

The Contact Form 7 Plugin is an incredibly useful plugin and a great addition to any WordPress Installation. It is very well supported and regularly updated.

It does not, however, have a built-in redirect to a thank you page. Nonetheless, it has been very simple, to just use the

on_sent_ok

method to add a redirection to a “Thank You” page after a successful form submission. But that method is being deprecated soon and I wanted to find a simple alternative.

This Contact Form 7 support page explains a method of using javascript in order to enable redirection. But if you have more than one contact form that redirects to more than one thank you page, how do you differentiate?

One method might be to add the javascript code to separate template. But it seems easier to add the following piece of code to the WP functions.php file, using the Contact Form 7 number from the shortcode: