Redirect commenter to thank you post or page

Adding this snippet to the functions.php of your wordpress theme will redirect a commenter to any post or page you specify. Consider redirecting a commenter to a thank you page when they comment on a post.

 

 

add_filter('comment_post_redirect', 'redirect_after_comment');
function redirect_after_comment(){
wp_redirect('/page/');
exit();
}

Leave a comment