I’m kinda confused on why you’re passing 0 as meta_value, but if your storing unix timestamps under anniversary_date
, this approach should be sufficient:
// queries anniversary dates between today and the next 30 days
$query = new WP_Query(array(
'order' => 'ASC',
'orderby' => 'meta_value',
'meta_key' => 'anniversary_date',
'meta_value' => array(strtotime('today'), strtotime('+30 days')),
'meta_compare' => 'BETWEEN'
));