Php 如何根据评论数量和不足一年的时间查询wordpress帖子?

Php 如何根据评论数量和不足一年的时间查询wordpress帖子?,php,wordpress,Php,Wordpress,我有以下代码,返回评论最多的帖子: $popPosts = new WP_Query(); $popPosts->query('ignore_sticky_posts=1&posts_per_page='.$posts.'&orderby=comment_count'); 我需要修改它,这样它就不会返回任何超过一年的文章。有人能提供解决方案吗 谢谢 类似的内容可能会有所帮助: $args = array( 'date_query' => array(

我有以下代码,返回评论最多的帖子:

$popPosts = new WP_Query();
$popPosts->query('ignore_sticky_posts=1&posts_per_page='.$posts.'&orderby=comment_count'); 
我需要修改它,这样它就不会返回任何超过一年的文章。有人能提供解决方案吗


谢谢

类似的内容可能会有所帮助:

$args = array(
    'date_query' => array(
        array(
            'column' => 'post_date_gmt',
            'after' => '1 year ago',
        )
    ),
    'posts_per_page' => $posts,
    'ignore_sticky_posts' => 1,
    'orderby' => 'comment_count'
);
$query = new WP_Query( $args );
如图所示:(在“日期参数”下)