Support » Fixing WordPress » How to redirect people to a page after commenting?

  • Hi,

    I was wondering if there’s an easy way to add a code snippet somewhere that basically redirects people to a specified “thank you” page after they’ve left a comment, instead of showing them the same one with their comment added?

    I’ve tried two plugins (“Comment Redirect” and “MSMC – Redirect After Comment”) that supposedly do the job, but they’re outdated and don’t do anything.

    As I understand it this should be achievable by modifying functions.php or another theme file?

    My blog is at:

    Any help here would be greatly appreciated!


Viewing 7 replies - 1 through 7 (of 7 total)
  • wpismypuppet


    I think this is what you are looking for…

    You are probably more interested in the “action hook” since you mentioned the functions.php file. Let me know if this helps!

    Thanks a lot for the quick answer.

    It’s actually the other way round – I’m mentioning functions.php because I saw the exact post that you’ve pointed to.

    I have tried it (replacing the with the actual URL for my thank you page), but nothing happens. Well, actually what happens is that instead of redirecting me to the “original-page/#comment-numberXXX” it now just redirects me to “original-page”.

    Are there any other ways to perform the same thing?


    I have been digging a bit more into this. Seeing how I’m using the “Jetpack” commenting system, I assume I’d have to add a redirect line in the Jetpack settings somewhere?

    Is anyone able to help on this?



    Sorry for not getting back to you sooner… things came up. The snippet of code that you put in the functions.php file definitely works… as long as you are sending them to a page within your site. I’ve tested and used the code myself. I double checked it again this morning to make sure it works.

    The reason it’s not working for you probably has something to do with Jetpack. I’ll do more research and see what I can find, but I don’t know much about Jetpack.


    Thanks. I have no doubt that the code snippet works in general, since most people are using it with success. I’ve also gotten as far as to deducing it’s due to Jetpack’s commenting system, meaning I’d have to do tweaks in the Jetpack plugin itself (e.g. jetpack-comments.php) or something.

    If anyobody’s able to help on this I’d really appreciate it!




    I got this from their tech support:

    > Is it possible to redirect users to a thank you page after they submit a
    > comment?

    Hi Daniel,

    Thanks for getting in touch with us.

    Jetpack Comments does not currently include such feature.

    To solve this issue, I would recommend searching for a comment redirection plugin in the plugin repository, and test it to see if it’s compatible with Jetpack Comments:

    Please let us know if you have any more questions.

    Happiness Engineer | | Automattic

    Since you’ve already tested all the plugins, I’m guessing you’re out of luck at this point. And since people get directed to a different site to submit comments, I doubt you could use JavaScript.

    You “might” be able to use PHP $_SERVER[‘HTTP_REFERER’] variable on your single.php page to check incoming traffic and redirect them based on where they came from? I haven’t tested it, and don’t really know how Jetpack works, but that might be your best shot.

    Hi there,

    Thanks. Sounds like I’m basically out of luck, since what you’re describing is too advanced (I’m a newbie in all things PHP/HTML, etc.).

    I was just hoping there’s a very easy line to tweak somewhere with a fixed value instead of the redirect to current page that already exists.

    Appreciate the attempts to help, if you do come across something that helps I’d love to hear it.


Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘How to redirect people to a page after commenting?’ is closed to new replies.