Skip to content

Instantly share code, notes, and snippets.

@jackperry
Created May 19, 2015 06:52
Show Gist options
  • Save jackperry/69d8c4d7327a135f5cda to your computer and use it in GitHub Desktop.
Save jackperry/69d8c4d7327a135f5cda to your computer and use it in GitHub Desktop.
ACF meta_query Post-Fix
<?php
$today = date('Ymd');
$meta_query = array(
'relation' => 'OR',
array(
'key' => 'custom_date',
'compare' => '>=',
'value' => $today
),
array(
'key' => 'custom_date',
'compare' => 'NOT EXISTS',
'value' => ''
),
array(
'key' => 'custom_date',
'compare' => '=',
'value' => ''
)
);
$query->set( 'meta_query', $meta_query );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment