我爱占星网 我爱占星网
首页
编程
java
php
前端
首页 编程 java php 前端

Wordpress过去三天的所有帖子

I was wondering if there is a way to limit wp_query´s result by the creation date? I only want to get all post not older than three days.

You can use WP_Query's date parameters to accomplish this.

http://codex.wordpress.org/Class_Reference/WP_Query#Date_Parameters

$args = array(
    'date_query' => array(
        array(
            'after'     => $threeDaysAgo,  
            'inclusive' => true,  
        ),  
    ),
    'posts_per_page' => -1,
);
$query = new WP_Query( $args );

After can take strtotime() compatible strings. http://php.net/manual/en/function.strtotime.php

近期文章

  • 如何上传视频的持续时间?
  • php需要在数组顶部移动一个元素
  • mysql_query():拒绝访问用户''@ localhost'[重复]
  • 应该是新月的增加日期
  • Php require()无法识别别名类
  • 从杂货店的多个表中列出
  • 如何用准备好的陈述按时间排序?
  • Php正则表达式,匹配{}字符未显示
  • 交叉编译php与OPcache支持错误
  • Laravel刀片有条件地分配css类
  • 与Laravel Echo和Pusher问题聊天应用程序
  • Codeigniter 3路由和处理404错误
  • Google reCaptcha v3将成功归为false
  • PHP - 无法在php-fpm上更改memory_limit
  • 哪个MySQL数据类型用于IP地址? [重复]
  • 使用受保护的方法注入类实例
  • 从php多维数组中选择数据
  • 从需要POST数据的站点获取数据?
  • CodeIgniter - 检查真实结果的最佳方法
  • 媒体转换库/插件最好是php

Copyright ©2022 我爱占星 All Rights Reserved.

浙ICP备2022030071号-1

部分图文来自网络,如有侵犯您的版权,请告诉我们删除

友情链接:代码精华