WordPress.org

Ready to get started?Download WordPress

Forums

redirect after comment post not jumping to new comment? (3 posts)

  1. _ck_
    Member
    Posted 7 years ago #

    I have a fairly new WP 2.0.3 install running on apache 1.3 with php 4 and I am using a template based on the old classic single index.php with comments.php

    I've noticed one problem that's bothering me.

    After a NEW comment is posted, wp-comments-post.php does it's job and redirects back to the original post page.
    HOWEVER, is it not supposed to send that person back to see their comment by adding #comment-1234 to the end of the URL?

    I thought this was the purpose of get_permalink at the end of that function, and inject it into the location header?

    I am using the second permalink option:
    Date and name based
    http://example.com/blog/2006/07/24/sample-post/

    Thanks for any help!

  2. kuttnhaste
    Member
    Posted 7 years ago #

    I'm having this problem too. Is there an option to turn it on?

  3. spencerp
    Member
    Posted 7 years ago #

    If I remember right, they had removed that option before, for 2.0, 2.0.1, 2.0.2, 2.0.3.. I'm not positive if they re-added it for the latest of 2.0.4..

    But, you can do the following:
    http://trac.wordpress.org/ticket/2891

    The code changes are as such:

    Open the wp-comments-post.php file.

    Near bottom, find this line:

    wp_redirect( $location );

    Then replace with this line:

    wp_redirect( $location . "#comment-" . $comment_id );

    I hope this helps.

    spencerp

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.