for people using the User Metadata Manager , you will find that the datepicker field is stored as a timestamp.
Thus, in a similar case, the above example does not work, and you can configure php to the value you need to compare. And marking the day a day earlier at 23:59:59 he will do the job:
$yesterday = strtotime('yesterday 23:59:59'); $args = array( 'post_type' => 'post', 'meta_key' => 'end-date', 'meta_query' => array( array( 'key' => 'end-date' ), array( 'key' => 'end-date', 'value' => $yesterday, 'compare' => '>=' ) ), 'orderby' => 'meta_value', 'order' => 'ASC' ); $your_custom_query = new WP_Query($args);
If you also want to consider the time zone setting for the blog, use current_time () , as in the following example:
$now = current_time('timestamp'); $yesterday = mktime(23, 59, 59, date('n',$now), date('j',$now)-1);
balubino
source share