WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

When user clicks on Reply button for a specific comment, how can I then hide the reply button under said comment? Do I have any access to the javascript onclick function that it calls?

share|improve this question
up vote 1 down vote accepted

Ended up using jQuery to solve this. The form moves around using javascript anyways so it doesn't break anything for users with js turned off.

//when reply button is clicked hide it
$(".comment-reply-link").click( function() {

    //when cancel button is clicked reshow reply button
$("#cancel-comment-reply-link").click( function() {
share|improve this answer

You can "wrap" the function by renaming it and defining your own function with the same name, that calls the renamed function. The "cancel" handler is internal, so you can't access that.

var oldAddComment = addComment;
addComment = {
    moveForm: function(commId, parentId, respondId, postId) {
        var retVal = oldAddComment.moveForm(commId, parentId, respondId, postId);
        // Your code to hide the link here
        return retVal;

You could also unregister the comment-reply Javascript, and register your own version. Or you can hook up extra handlers to the click event, with plain Javascript or with jQuery, as you have done.

share|improve this answer
Very clever. Thank-you for showing me this. How would I have figured this out on my own? – mrtsherman Mar 23 '11 at 22:07
I'm going to end up marking my own solution as correct because I think it is easier to implement. +1 to you though for what seems like a very appropriate solution(s). – mrtsherman Mar 24 '11 at 19:08
@mrtsherman: No problem, you should accept the answer that helped you solve the problem - even if you found the answer yourself! And your solution is more complete, because you also handle the cancel event. – Jan Fabry Mar 24 '11 at 19:33

Your Answer


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.