最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

wp query - Most commented post showing 2 records

programmeradmin7浏览0评论

I am trying to show the most commented post. Only one post should show but I am getting 2 even though the number of comments is not the same?

<?php $args = array(
        'orderby' => 'comment_count',
        'posts_per_page' => 1,
      );
      $most_commented = new WP_Query($args); 
?>
<?php if ($most_commented->have_posts() ):
            while ($most_commented->have_posts() ): $most_commented->the_post();
            $author_id = get_the_author_meta( 'ID' );
?>

  <?php // display info about blog post here ?>

<?php endwhile; wp_reset_postdata(); ?>
<?php endif; ?>
发布评论

评论列表(0)

  1. 暂无评论