It may be worth trying this code which goes into your theme’s functions.php file:
global $wp_version;
if (version_compare($wp_version, '5.1.1', '>=')) {
add_filter('comment_reply_link', 'haremu_replace_comment_reply_link', 10, 4);
function haremu_replace_comment_reply_link($link, $args, $comment, $post)
{
if (get_option('comment_registration') && !is_user_logged_in()) {
$link = sprintf(
'<a rel="nofollow" class="comment-reply-login" href="%s">%s</a>',
esc_url(wp_login_url(get_permalink())),
$args['login_text']
);
} else {
$onclick = sprintf(
'return addComment.moveForm( "%1$s-%2$s", "%2$s", "%3$s", "%4$s" )',
$args['add_below'],
$comment->comment_ID,
$args['respond_id'],
$post->ID
);
$link = sprintf(
"<a rel='nofollow' class='comment-reply-link' href='%s' onclick='%s' aria-label='%s'>%s</a>",
esc_url(add_query_arg('replytocom', $comment->comment_ID, get_permalink($post->ID))) . "#" . $args['respond_id'],
$onclick,
esc_attr(sprintf($args['reply_to_text'], $comment->comment_author)),
$args['reply_text']
);
}
return $link;
}
}
Disclaimer: Not my work. Retrieved from https://haremu.com/p/527
I used it for a separate issue when I couldn’t get comment data to POST – you’d click ‘submit’ and nothing would happen. It seems WordPress 5.1 changed the way this works, and this fixes it.