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.

I am trying to remove the "Click here to cancel reply" link from the Wordpress comment form on my posts. In the document there is an argument you can supply to the comment form function to remove the link, but it doesn't appear to be working. The documentation link: http://codex.wordpress.org/Function_Reference/comment_form

I have tried different values for the cancel_reply_link value including double quotes, double quotes with a space between them, a zero and a value of false; all of which were to no avail. Surely I am overlooking something here as removing that link is pretty common in Wordpress installations.

Here is the current function call with parameters that I am using at present:

<?php comment_form(

array(
    'comment_notes_before' => FALSE,
    'comment_notes_after'  => FALSE,
    'cancel_reply_link'    => FALSE
)

); ?>

Your help is gratefully appreciated.

share|improve this question
add comment

2 Answers 2

up vote 2 down vote accepted
add_filter( 'cancel_comment_reply_link', '__return_false' );

See /wp-includes/comment-template.php#function get_cancel_comment_reply_link() for more background.

But if you do that the reply form will not move to the comment. The more interesting question is: Why doesn’t the link work for you? Do you have this line in your footer?

is_singular() and get_option( 'thread_comments' ) and wp_print_scripts( 'comment-reply' );
share|improve this answer
    
Good snippet for filter, I should remember to use those __ returns more often (I use some wrappers around filters in my code so usually stick with and less used to native). As for why it fails - see my answer. Passing empty() stuff around often yields unexpected results in WP. –  Rarst Feb 8 '11 at 7:28
    
Thanks Toscho. This worked flawlessly! –  DigitalSea Feb 9 '11 at 23:02
add comment

When you pass false to that argument get_cancel_comment_reply_link() function that is used down the chain falls back to default value.

Pass something else (like single space) or filter cancel_comment_reply_link hook to override output.

share|improve this answer
add comment

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.