The function comment_reply_link
echos the function get_comment_reply_link
. If you look at the source code you see, that up to 3 arguments are needed for a proper functionality.
$args
an array of optional arguments that overwrite the default values$comment
an optionalcomment_id
or WP_Comment object the comment should reply to.$post
an optionalpost_id
or WP_Post object where the comment is going to be displayed on.
If the function returns null
, it cannot figure out the relating $post
. Try to add this parameter to your function call, e.g. comment_reply_link(null, null, $post_id)
or $comm.= get_comment_reply_link(null, $comment);
(within your foreach loop).
If the function returns false
, comments are disabled for this post.
Source: developer.wordpress.org