Skip to content

Instantly share code, notes, and snippets.

@jackperry
Last active August 29, 2015 14:21
Show Gist options
  • Save jackperry/7c583ca57b292bf69b9f to your computer and use it in GitHub Desktop.
Save jackperry/7c583ca57b292bf69b9f to your computer and use it in GitHub Desktop.
ACF meta_query Pre-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' => ''
)
);
$query->set( 'meta_query', $meta_query );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment