I've broken my posts and comments into two tabs, the second of which is called #comments. An issue arises when a comment is posted, as the reader is directed to a #comment-259 url. That of course breaks my tab feature.
To correct this, I'm using a simple function to filter the url users are redirected to after they post a comment:
add_filter('comment_post_redirect', 'redirect_after_comment');
function redirect_after_comment($location)
{
return '/need-it-to-be-the-permalink#comments';
}
I simply need to know how to fetch the permalink of the post the user commented on, and use that in the "return" url in the above function (where I typed /need-it-to-be-the-permalink#comments)
Thanks, WP-ers.