mercredi 4 mars 2015

date_query not returning some posts but they seem to be in correct date range


I'm getting some very strange results with the date_query parameter of get_posts. I have a post for which:



date('Y-m-d H:i', get_post_time('U', false, $postid))


returns:



2014-04-03 10:42


This post is returned fine from get_posts with these arguments:



$args = array(
'post_type' => 'post',
'cat' => 41,
'fields' => 'ids'
);


But not with these:



$args = array(
'post_type' => 'post',
'date_query' => array(
'after' => '1980-01-01',
'before' => '2100-01-01',
),
'cat' => 41,
'fields' => 'ids',
);


Other posts seem to come back fine. What could be up? Does date_query query something different to get_post_time?





Aucun commentaire:

Enregistrer un commentaire