调用近期文章更新数量的一些方法

调用最近N天更新了多少篇文章

  1. function get_today_post_count(){
  2.     $date_query = array(
  3.     array(
  4.     'after'=>'6 day ago'
  5.     )
  6.     );$args = array(
  7.     'post_type' => 'post',
  8.     'post_status'=>'publish',
  9.     'date_query' => $date_query,
  10.     'no_found_rows' => true,
  11.     'suppress_filters' => true,
  12.     'fields'=>'ids',
  13.     'posts_per_page'=>-1
  14.     );
  15.     $query = new WP_Query( $args );
  16.     return $query->post_count;
  17.     }
话题:
No Tag

相关推荐