Quantcast
Channel: Topic Tag: MySQL | WordPress.org
Viewing all articles
Browse latest Browse all 5527

svsdnb on "Query Date Array To Display Future Events Only"

$
0
0

I found the actual issue so I thought I'd update.

ACF documentation says to use $today = date ('Ymd') to compare dates but you really need to use current_time('Ymd') so I removed the functions.php code that I added and fixed the problem rather than work around it.

Here's my query now

$event1 = current_time('Ymd');
	$args = array(
        'post_type' => 'events',
	'post_status' => 'publish',
	'posts_per_page' => '10',
	'meta_query' => array(
		array(
			'key' => 'event_date_ends',
			'compare' => '>=',
			'value' => $event1,
			)
			),
	'meta_key' => 'event_date_ends',
	'orderby' => 'meta_value',
	'order' => 'ASC',
	'paged' => ( get_query_var('paged') ? get_query_var('paged') : 1 ),
);

Viewing all articles
Browse latest Browse all 5527

Trending Articles