Archived topic
H3 Comment Reply Title
7 replies · Started by Jesse on June 1, 2021
Hello,
Visually, I can only see "Leave a Comment" on my screen. However, when I check the source code, the H3 for that "Leave a Comment" heading is actually "Leave a Comment Cancel reply" - how can I fix this so that the H3 is only "Leave a Comment"? The "Cancel reply" part should be removed from that H3.
Best regards,
Jesse
Hi Jesse,
That one you see is this: https://share.getcloudapp.com/d5uA4qlL
It's a WordPress default. All themes have it.
But to help you out:
Try this PHP filter -
add_filter( 'cancel_comment_reply_link', '__return_false' );
Here's how to add PHP snippets to your site - https://docs.generatepress.com/article/adding-php/
Hello Elvin,
By adding that filter, is it disabling any sort of functionality? What is that filter doing exactly?
Best regards,
Jesse
By adding that filter, is it disabling any sort of functionality? What is that filter doing exactly?
It removes the Cancel Reply link added within the comment label H3 tag.
Where does that “Cancel reply” link come from? By using this filter, will someone no longer be able to cancel their reply? Or will that functionality still be there?
Best regards,
Jesse
Where does that “Cancel reply” link come from? By using this filter, will someone no longer be able to cancel their reply? Or will that functionality still be there?
As previously mentioned. It's WordPress default. Even the default themes have it. https://github.com/WordPress/WordPress/blob/270f2011f8ec7265c3f4ddce39c77ef5b496ed1c/wp-includes/comment-template.php#L1898
By using this filter, will someone no longer be able to cancel their reply? Or will that functionality still be there?
To be honest, I'm not even sure why WordPress keeps it. It's set to "display: none;" by default so basically, it's not even showing on the site for interactive purposes.
And users can always simply refresh the page if they don't wish to push through with the comment, this effective "cancels" the reply.
Thanks, Elvin. The filter seems to work perfectly!
No problem. Glad to be of any help. :D