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;
}
(@aaffleck)
12 years, 7 months ago
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.