首页 > 解决方案 > 当我使用 WP Comment_query() 时,没有出现回复评论链接

问题描述

我正在尝试使用评论自定义字段获取评论,因为我使用了 WP_Comment_Query() 但在回复链接中没有显示该函数。这是我的代码:

    <?php
            $args = array(
               'type' => 'comment',
                'meta_key' => 'comment-type',
                'meta_value' => 'Other',
            );
            // The comment query
            $comments_query = new WP_Comment_Query;
            $comments = $comments_query->query( $args );
            
            // The comment loop
            if ( !empty( $comments ) ) {
                foreach ( $comments as $comment ) {
                    ?>
    <div class="comment-text"><?php comment_text(); ?></div>
    <div class="reply">
<?php
                            // Display comment reply link
                            get_comment_reply_link( array_merge( $args, array(
                                'add_below' => $add_below,
                                'depth'     => $depth,
                                'max_depth' => $args['max_depth']
                            ) ) ); ?>
                        </div   
                    <?php
                }
            } else {
                echo 'No comments found.';
            }
                    ?>

标签: wordpresscomments

解决方案


推荐阅读