• Prerequisite: WordPress installed in sub-directory.

    Just in case anyone else is looking to redirect users back to the post they just posted a comment on and have it scroll to the last posted comment from that user without hacking core files:

    Add this to your themes functions.php file.

    add_filter('comment_post_redirect', 'redirect_after_comment');
    function redirect_after_comment($location)
    {
    	global $wpdb;
    	return $_SERVER["HTTP_REFERER"]."#comment-".$wpdb->insert_id;
    }
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Comment Post Redirect’ is closed to new replies.