wp query – WordPress WP_Query Sort by 2 dates – custom fields

Question

I have a query that needs to have 2 post types ['track_trip', 'training']. Those 2 types have ACF custom fields that stand for future dates. ['date_track', 'date_training']. How should I combine my query to sort those types based on a custom field? Both are date type of course.

new WP_Query([
 'post_type' => ['tourist_trip', 'training'], 
 'post_status' => 'publish', 
 'meta_key' => 'date_tourist',  ??
 'orderby' => 'meta_value', 
 'order'=> 'ASC'];
])

0
Masmiix 2 months 2022-12-09T11:57:27-05:00 0 Answers 0 views 0

Leave an answer

Browse
Browse