Archived topic
Cannot reply to comments
22 replies · Started by Jesse on July 30, 2021
Hi David,
I figured it out. First, the reply button worked normally when Yoast was the only plugin I disabled. This is why I thought the issue was with Yoast alone.
I did some additional testing, and as it turns out, the reply button worked normally when Yoast was ENABLED but only if the Code Snippets plugin was DISABLED. This meant one of my snippets was conflicting with Yoast.
So I started turning off my snippets one at a time, and I narrowed it down to this filter:
add_filter( 'cancel_comment_reply_link', '__return_false' );
I can leave all plugins turned on as normal. When I turn off this one single filter, my reply button works normally again. The above filter is discussed here: https://generatepress.com/forums/topic/h3-comment-reply-title/
It fixed an issue where the H3 within the HTML would appear as "Leave a Comment Cancel reply" instead of just "Leave a Comment" which I wanted to clean up for accessibility purposes.
So now my reply button works normally again, but my H3 is back to "Leave a Comment Cancel reply" which bugs me. Any ideas?
Best regards,
Jesse
Ah good find... not sure why removing that would break the reply link. I would suggest opening a topic with Yoast support to see if they have any ideas.
Hi David,
Yoast provided a video of their test environment where they added this filter:
add_filter( 'cancel_comment_reply_link', '__return_false' );
And the comment reply button worked normally. I did some more testing today and as soon as I turn this filter on, it breaks the comment reply button.
Do you have any other thoughts? Yoast suggested that maybe the "cancel reply" text could be removed within the child theme.
Best regards,
Jesse
The Comment Reply form is only output once in the WP comments-form.php template. When you reply to an existing comment it uses Javascript to move the form and rewrite the reply link etc. So there is no way to remove it without it affecting ALL replies.
Instead of disabling the cancel reply link you could try simply returning an empty space in its place:
add_filter( 'cancel_comment_reply_link', function() {
return ' ';
} );
Thanks, David. Great idea, but unfortunately that filter creates the same behavior. The standard reply button stops working when I enable it.
Running out of options here... but i did find this clever snippet:
https://seobro.de/wordpress-kommentare-link-bearbeiten-abbrechen/
It removes the default comment reply cancel link and hooks a replacement link in below the comments form.
Hi David,
I like that one, thanks!
Awesome - glad to be of help!