Wordpress查询统计特定类别中每天的更新帖子

Wordpress查询统计特定类别中每天的更新帖子,wordpress,categories,Wordpress,Categories,有人知道如何使用wordpress查询统计特定类别中每天的更新(例如:在这一天/日期)吗 非常感谢。我不知道我是否完全理解你的问题,你想知道在特定的日子/日期发布的特定类别的帖子数量吗 在本例中,您只需创建一个实例并传入您希望查看的和 大概 <?php $today = getdate(); $args = array('year' => $today["year"], 'monthnum' => $today["mon"], 'day' => $today["mday"

有人知道如何使用wordpress查询统计特定类别中每天的更新(例如:在这一天/日期)吗


非常感谢。

我不知道我是否完全理解你的问题,你想知道在特定的日子/日期发布的特定类别的帖子数量吗

在本例中,您只需创建一个实例并传入您希望查看的和

大概

<?php
$today = getdate();
$args = array('year' => $today["year"], 'monthnum' => $today["mon"], 'day' => $today["mday"], 'category_name' => 'Uncategorized');
$search = new WP_Query($args);
$count = $search->found_posts;
?>

如果您希望根据修改的日期返回帖子(您声明每天更新帖子的次数,我不理解),那么您需要添加一个“posts\u where”过滤器,而不是args的时间参数

请参阅上面的时间参数链接,以获取示例代码和有关使用它的解释-但是在稍微修改其中一个示例时,您可以创建类似的内容

// Create a new filtering function that will add our where clause to the query
function filter_where( $where = '' ) {
$where .= " AND post_modified >= '2010-03-01' AND post_modified < '2010-03-16'";
return $where;
}

add_filter( 'posts_where', 'filter_where' );
$query = new WP_Query( $query_string );
remove_filter( 'posts_where', 'filter_where' );
//创建一个新的筛选函数,将where子句添加到查询中
函数筛选器_其中($where=''){
$where.=“和修改后>='2010-03-01'和修改后<'2010-03-16';
返回$where;
}
添加_过滤器('posts_where','filter_where');
$query=新的WP\u查询($query\u字符串);
移除_过滤器('posts_where','filter_where');

谢谢你的帮助,这就是我要找的。。。但我是用我自己的密码解决的。