WEB Wordpress question

Discussion in 'OT Technology' started by carlo2343, Nov 13, 2009.

  1. carlo2343

    carlo2343 New Member

    Joined:
    Jul 20, 2005
    Messages:
    6,443
    Likes Received:
    0
    I want to redirect users to a new page after they leave a comment. What do I need to edit in the wp_comments or wp_comments_post files in order to redirect them to a different page after they comment?
     
  2. Krakerjak

    Krakerjak Active Member

    Joined:
    Jul 7, 2003
    Messages:
    8,288
    Likes Received:
    0
    Location:
    Edmonton eh
    modifying those files isn't always good, since an update to wp can undo your changes

    You can add:

    Code:
    <input type="hidden" name="redirect_to" value="http://forums.offtopic.com/">
    something like that to your comment form in your comments.php

    or you could make a really simple plugin that modifies the 'comments_post_redirect' filter hook to your own url...
    ie. adding this as redirect_on_comment.php to your plugins folder...and activate it
    Code:
    <?php
    /*
    Plugin Name: Redirect on comment
    */
    
    
    function change_redirect($url) {
            $url = 'http://forums.offtopic.com/forumdisplay.php?f=168';
            return $url;
    }
    
    add_filter('comment_post_redirect','change_redirect',10,1);
    ?>
     
    Last edited: Nov 13, 2009

Share This Page