Redirect CF7 After Submission using PHP action hook.
/**
* Redirect CF7 After Submission
*
* Accepts 'custom_on_sent_ok' parameter in CF7 form additional settings. e.g.,
* custom_on_sent_ok: http://example.com/thank-you
*/
add_action( 'wpcf7_mail_sent', 'custom_redirect_cf7_form' );
function custom_redirect_cf7_form( $wpcf7 ) {
$on_sent_ok = $wpcf7->additional_setting('custom_on_sent_ok', false);
if ( is_array( $on_sent_ok ) && count( $on_sent_ok ) > 0 ) {
wp_redirect( trim( $on_sent_ok[0] ) );
exit;
}
}