Or, embed this snippet using GenerateWP WordPress Plugin.

Download

Clone

Redirect to custom page after commenting

When a visitor successfully post a comment on the site, redirect him to custom newsletter registration page, using ‘comment_post_redirect’ filter.

function redirect_to_newsletter_after_sending_comments( $location, $comment ) {
	return home_url( '/subscribe-to-weekly-newsletter/' );
}
add_filter( 'comment_post_redirect', 'redirect_to_newsletter_after_sending_comments', 10, 2 );