Using WP-Query, I'm setting the Orderby parameter using an array:
$events_args = array(
'post_status' => 'publish',
'post_type' => 'events',
'meta_key' => 'start_time',
'meta_type' => 'DATETIME',
'orderby' => array( 'meta_value_num' => 'DESC', 'title' => 'ASC' ),
'order' => 'ASC',
'posts_per_page' => -1,
'meta_query' => array(
array(
'key' => 'event_date',
'compare' => '=',
'value' => 20150225,
)
)
);
I need to filter the first item in the array (meta_value_num). Using add_filter , how can I access the first item of the Orderby array to make the adjustments I need?
Thank you!
pre_get_postswill help you.