是否可以使用以下代码获取meta_key
deadline
大于特定日期值的所有帖子?
<?php $args = array(
'posts_per_page' => 5,
'offset' => 0,
'category' => '',
'category_name' => '',
'orderby' => 'date',
'order' => 'DESC',
'include' => '',
'exclude' => '',
'meta_key' => 'deadline',
'meta_value' => LARGER THAN 2016-04-19,
'post_type' => 'post',
'post_mime_type' => '',
'post_parent' => '',
'author' => '',
'post_status' => 'publish',
'suppress_filters' => true
);
$posts_array = get_posts( $args ); ?>
怎么做?
答案 0 :(得分:1)
添加日期查询:
'meta_query' => array(
array(
'key' => 'deadline'
),
array(
'key' => 'the_date',
'value' => '2016-04-19',
'compare' => '>='
)
),
根据需要修改它,但这应该有用。