I'm trying to figure out the actual difference in what is happening between these two args setups for a wp_query
$today= date('Ymd');
$homepageEvents = new WP_Query(array(
'post_type' => 'event',
'posts_per_page' => -1,
'orderby' => 'meta_value_num',
'meta_key' => 'event_date',
'order' => 'ASC',
'meta_query' => array(
array(
'key' => 'event_date',
'compare' => '>=',
'value' => $today,
'type' => 'numeric'
)
)
));
vs
$today= date('Ymd');
$homepageEvents = new WP_Query(array(
'post_type' => 'event',
'posts_per_page' => -1,
'orderby' => 'event_date',
'order' => 'ASC',
'meta_query' => array(
array(
'key' => 'event_date',
'compare' => '>=',
'value' => $today,
'type' => 'numeric'
)
)
));
The only diffence is in one, it is setup as a orderby
using a parameter of meta_value_num
which then requires adding a meta key set to the field name. In the other the orderby
just uses the fieldname itself.
Does this result in the same query or am I asking 2 questions that just happen to have the same answer?