For example, today is 25 January 2016, i want to get the posts that are published between TODAY with year 2015, month December, day 25.
It seems simple, but there are issues where the month ends with 30,31, 28, etc. Not to mention i have to manually count whether it is January (because if it's january, i have to reduce the year by 1, current_year - 1).
Anyone have a good solution for the WP_Query to achieve this?
WP_Query(https://codex.wordpress.org/Class_Reference/WP_Query) allows you use time shifting in format of php-function strtotime(). Ex:
$args = array(
'date_query' => array(
array(
'after' => '-1 month',
),
),
);
$query = new WP_Query( $args );
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With