Your syntax is incorrect for your date_query
. It should be an array of an array, not just an array.
I also suspect that your problem might be related to PHP and not WordPress.
Your before
date is invalid. PHP only supports dates between 13 December 1901 and 19 January 2038, so your dates need to between those two dates. For reference, see date
You would also want to include the ‘inclusive’ parameter and set it to true
for exact matches
Your query should be something like
$args = array(
'post_type' => 'post',
'date_query' => array(
array(
'after' => '1980-01-01',
'before' => '2038-01-01',
'inclusive' => true,
),
),
'cat' => 41,
'fields' => 'ids',
);