WordPress

Redirect WordPress Commenters To A Thank You Page

If you have your own blog you will know important it is to have people comment on it. There are many things you can do to encourage people to comment on your blog.

You can have do follow links in your post so that the commenter will get a link back to there websites as a thank you for the comment. But why not actually say thank you to people who comment on your blog, this can be done by redirecting your commenter to a thank you page you make in WordPress.

Here is a WordPress snippet to add to your functions.php page which will redirect the commenter to a thank you page.

add_filter('comment_post_redirect', 'redirect_to_thank_you_page');
function redirect_to_thank_you_page(){
      wp_redirect('/thank-you-for-your-comment');
      exit();
}
Back to top

Learn how to code with Treehouse

  • Learn projects with access to 1000+ videos
  • Practice live with our Code Challenge Engine
  • Get help in our members-only forums

Start with a 7 day free trial