WordPress Snippets at WPcustoms

Redirect comment author after posting

Redirect your comment author when his comment is submitted. Create a thank you page or whatever you have in mind and adjust the wp_redirect url using the slug of the page. You can i.e. create a bonus page to encourage your site’s comment activitiy and give rewards \ special offers.


/**
 * Snippet Name: Redirect comment author after posting
 * Snippet URL: https://wpcustoms.net/snippets/redirect-comment-author-posting/
 */
  function wpc_redirect_after_comment(){
      wp_redirect('/thank-you/');
      exit();
}
add_filter('comment_post_redirect', 'wpc_redirect_after_comment');