Home » Ask (Forum) » WordPress Comment redirect after commenting


Hello, I will share a tutorial about how to make WordPress Comment Redirect to a special page after commenting. Example, you want your user redirect to thank you page after commenting.

Using WordPress action hook

Hooks are provided by WordPress to allow your plugin to ‘hook into’ the rest of WordPress; that is, to call functions in your plugin at specific times, and thereby set your plugin in motion.

Open your functions.php file in theme folder and insert these lines:

// Redirect to thank you post after comment
add_action('comment_post_redirect', 'bikinwebsite_redirect_page');

function bikinwebsite_redirect_page() {
    return 'http://yourdomain.com/thank-you-page';


add_action('comment_post_redirect', 'bikinwebsite_redirect_page');

function bikinwebsite_redirect_page($location, $comment) {
    // Here all you need to do is return the url of your target page.
    $page = 'http://yourdomain.com/thank-you-page';
    return $page;

That’s all. It is simple and easy 🙂

Nov 8, 2016 (3 years ago) - Posted by No Comments

Your Answer

Your email address will not be published. Required fields are marked *