WordPress.org

Ready to get started?Download WordPress

Forums

How to redirect people to a page after commenting? (8 posts)

  1. DanielNest
    Member
    Posted 1 year ago #

    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: http://nest-expressed.com/

    Any help here would be greatly appreciated!

    Thanks,
    Daniel

  2. wpismypuppet
    Member
    Posted 1 year ago #

    I think this is what you are looking for...

    http://www.deluxeblogtips.com/2010/03/wordpress-redirect-to-thank-you-page.html

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

  3. DanielNest
    Member
    Posted 1 year ago #

    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 http://domain.com/thank-you 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?

    Daniel

  4. DanielNest
    Member
    Posted 1 year ago #

    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?

  5. wpismypuppet
    Member
    Posted 1 year ago #

    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.

  6. DanielNest
    Member
    Posted 1 year ago #

    Heya,

    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!

    Thanks,
    Daniel

  7. wpismypuppet
    Member
    Posted 1 year ago #

    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:
    http://wordpress.org/extend/plugins/

    Please let us know if you have any more questions.

    Jeremy
    Happiness Engineer | WordPress.com | 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.

  8. DanielNest
    Member
    Posted 1 year ago #

    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.

    Thanks,
    Daniel

Topic Closed

This topic has been closed to new replies.

About this Topic