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:
[cc lang=”php”]add_filter(‘comment_post_redirect’, ‘redirect_after_comment’);
function redirect_after_comment(){
wp_redirect(‘/page/’);
exit();
}
[/cc]
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]
John Saddington says
or you could check out this…
http://tentblogger.com/comment-workflow/
Eric Dye says
… and then do it! 😉
Roma says
Hi.This is work for all page when leave a comment
How i can make this only for one page?