Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

Searched through google but can't find anything related to it. Either I don't know what terms to use when searching or there's nothing about it.

I want to remove #comment-* we all know that it appears after some1 is submitting a comment.

So any thoughts on that one?

SOLVED:
I used a hook to redirect from the page where the comment was first submitted

add_filter('comment_post_redirect', 'redirect_after_comment');
function redirect_after_comment($location)
{
  return $_SERVER["HTTP_REFERER"];
}

Maybe will help someone in near future.

share|improve this question
4  
Please do not put your solution into the question. Write a real answer instead, and mark the question as answered then. –  toscho Apr 28 '13 at 15:30

1 Answer 1

The asker solved the issue with $_SERVER["HTTP_REFERER"] but refused to post that as a real solution.

Let me suggest something better, because the referer might be empty or full of malicious code. Never use that.

First, we make sure, we get both arguments for that hook:

add_filter( 'comment_post_redirect', 'wpse_97580_comment_redirect', 10, 2 );

Then we use the post ID of the comment to generate a safe URL for redirection:

function wpse_97580_comment_redirect( $location, $comment )
{
    return get_permalink( $comment->comment_post_ID );
}

In my opinion, this is bad for usability: the user might have to search her comment now on a long page.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.