After having successfully done a custom version of the WordPress comments form into a "sign up" page, I now need to re-direct the user to a custom page upon submitting the "form".
The page is done and the slug of the page is thank-you-for-signing-up
. Problem is, how do I check that the comments is coming from the sign-up
page (slug: sign-up) and if so, re-direct to my custom page?
This is the code I am trying to get working:
add_filter('comment_post_redirect', 'sign_up_redirect');
function sign_up_redirect( $location ) {
$signup_redirect = wp_redirect( home_url('/thank-you-for-signing-up/') );
if ( is_page( 'sign-up' ) ) {
return $signup_redirect;
exit;
}
}