Forums

How to NOT automatically redirect to comment after submit? (1 post)

  1. matsim
    Member
    Posted 3 weeks ago #

    Hey everyone,

    I'm looking for a way to redirect people who comment on a post back to that post rather than to their comment.

    Anybody know what to do? I've tried messing around with the bottom few lines of code in wp-comments-post.php but I'm not very experienced in code:

    $location = empty($_POST['redirect_to']) ? get_comment_link($comment_id) : $_POST['redirect_to'] . '#comment-' . $comment_id;
    $location = apply_filters('comment_post_redirect', $location, $comment);
    
    wp_redirect($location);
    
    ?>

    Am I in the right direction? Anybody have any suggestions?

    Thanks for your time!

    -Matsim

Reply

You must log in to post.

About this Topic