'date_query'
argument takes an additional option that is ‘relation’ that can be AND
or OR
.
If we consider the relation OR
your code, that use exactly same date for ‘before’ and ‘after’ with ‘inclusive’ set to true, should return all your posts: posts before a date + posts after that date + posts in that date.
If we consider the relation AND, it can be summarized in post_date >= date && post_date <= date
and that it’s true for date itself, but probably there’s something on date query class (I’ve not digged in the core) that prevents such a query, that to be honest, make no sense to me.
The reason is simple: if you want to query a specific date you don’t need to use after/before at all, just create an array with the year, month and day you want to display
$args = array(
'date_query' => array(
array(
'year' => 2012,
'month' => 12,
'day' => 12,
),
),
);
$query = new WP_Query( $args );
The code above is taken from second example for date query parameters in Codex.