Redirect the users to Thank you page after commenting – WordPress


Redirect the users to Thank you page after commenting – WordPress

 

Redirect the users to Thank you page after submitting the comments on your WordPress posts.Mostly we see this feature on Famous top blogs readers Are redirect to Thank you page or offer pages.

Just Follow this Below steps to activate this feature

  • Go to Appearance >Editor
  • Open themes functions.php file
  • Add this below PHP function Script on the file
function redirect_after_comment(){
wp_redirect('/thank-you/');
exit();
}
add_filter('comment_post_redirect', 'redirect_after_comment');
  • Create a thank you page or offer page or giveaway page for this write whatever you want to display in that page EX – Thanks for commenting blah blah
  • After that copy your page slug example.com/thank-you/ 
  • paste it on wp_redirect(‘/thank-you/‘);
  • That’s all Now your  readers  will be Redirect to Thank you page after commenting on your posts

If you Have Any Doubt in this topic, Please free to comment here

Read – How to execute the PHP code in WordPress Text widget

 


Was this article helpful?
Thanks!

Your feedback helps us improve Allwebtuts.com



33 Shares
+11
Tweet
Share31
Pin1
Stumble