cancel_comment_reply_link()
Display HTML content for cancel comment reply link.
No Hooks.
Return
null
. Nothing (null).
Usage
cancel_comment_reply_link( $link_text );
- $link_text(string)
- Text to display for cancel reply link. If empty. Default empty.
Default: 'Click here to cancel reply'
Examples
#1 Display a link that cancels the response to a certain comment:
<?php cancel_comment_reply_link(); ?>
Using Custom Text
<?php cancel_comment_reply_link( __( 'Cancel Reply', 'textdomain' ) ); ?>
#2 Change the html code of the link to cancel the response to a comment
To do this, use the cancel_comment_reply_link hook:
add_filter( 'cancel_comment_reply_link', 'cancel_comment_reply_link_html', 10, 3 ); function cancel_comment_reply_link_html( $formatted_link, $link, $text ){ return '<span id="cancel-comment-reply-link" style="display:none;">'. $text .'</span>'; }
Changelog
Since 2.7.0 | Introduced. |
cancel_comment_reply_link() cancel comment reply link code WP 6.6.2
function cancel_comment_reply_link( $link_text = '' ) { echo get_cancel_comment_reply_link( $link_text ); }