Want to Write for Us?Read This | LoginBecome a Member
wordpress-redirect-comments

Redirect WordPress Commenters to Specific Post/Page

With this small piece of WordPress snippet, you can redirect blog commenters to any post or page you specify.

I’m not sure about using this for a long term strategy. If we did that on ChurchMag, some of you might stop leaving comments after constantly being redirected. So, be sure to strategically think about this one.

Here are a few different things you can do with this:

  • Create a comment thank you page.
  • Invite commenters to “Like!” your Facebook page.
  • Solicit an e-newsletter sign-up.

Here’s the snippet that can easily be added to your functions.php theme file or bundled up into your own functionality plugin:

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

If you encased this into a functionality plugin, you could easily turn it off and on when you wanted to push e-newsletter sign-ups or an any other awesome idea you come up.

If you think of some other great uses for this, please share!

[via WordPress Code Snippets]

3 Responses to “Redirect WordPress Commenters to Specific Post/Page”

  1. October 3, 2011 at #

    or you could check out this…

    http://tentblogger.com/comment-workflow/

  2. Roma
    December 5, 2012 at #

    Hi.This is work for all page when leave a comment
    How i can make this only for one page?

Leave a Reply

Gravatar Image