比较Wordpress中的两个日期post_date和post_modified

时间:2015-03-19 04:50:41

标签: wordpress date compare

我想要post_modified>的过滤帖子post_date(已修改帖子)。

我用

查询数据库
"SELECT id, post_title, post_date, post_modified 
FROM wp_posts 
WHERE post_type = 'post' AND post_status = 'publish' AND DATE(post_date) <> DATE(post_modified) 
ORDER BY post_modified "

输出正确。

但如果我使用WP_query

PostQueryExample = new WP_Query(array('orderby' => 'modified', 'order' => 'DESC', 'post_type'=>'post','post_status' => 'publish', 'no_found_rows' => 1, 'ignore_sticky_posts' => 1,                           
        'date_query' => array(
                array(
                    'column' => 'post_date',
                    'compare' => '<',
                ),
                array(
                    'column' => 'post_modified',
                    'compare' => '>',,
                ))))

但显示输出错误,请帮帮我

1 个答案:

答案 0 :(得分:0)

试试这个

SELECT id,post_title,post_date,post_modified 来自wp_posts 在哪里post_modified&gt; post_date