Home / comment / Redirect commenter to thank you post or page
  • How to Redirect commenter to thank you post or page


    Why not thank your visitors! Let them know they are important by redirecting them to a thank you page where you can display a great big thank you for commenting on my wordpress site message. Adding this snippet to the functions.php of your wordpress theme will redirect a commenter to any post or page you specify. To update the snippet to a page change wp_redirect('/page/'); replace /page/ with whatever page you would like eg: wp_redirect('/thank-you/');.

    ( click code to copy )

    wordpress snippet : PHP

    add_filter('comment_post_redirect', 'redirect_after_comment');
    function redirect_after_comment(){

    ( WordPress codex functions, hooks, in this snippet. )

    comment_post_redirect, wp_redirect, comment_post, add_filter, wp,