EDITED - I discovered that my problem only arises when the Yoast plugin is active. But I want to keep Yoast active, so my updated question is: Any idea what to do for comment replies working while Yoast is activated?

Here's my original question:

In a custom theme created by myself, or rather its child theme on a multisite, I am having trouble with the comment_reply_link function. I am using it as follows:

<?php comment_reply_link(array_merge( $args, array('depth' =>$depth, 'max_depth' => \$args['max_depth']))) ?>


Now on the website, the link doesn't result in the expected /?replytocom=6#respond appended to the URL of the post, but simply in a local #comment-6 href attribute for the link. So when a user clicks on "Reply", nothing happens. When he/she writes a reply then, it is posted as a first-level reply, not as a reply to the intended previous comment.

To get the replytcom variables back we can add the following filter in our theme's functions.php
add_filter( 'wpseo_remove_reply_to_com', '__return_false' );