$query = new WP_Query(array
(
'post_type'=>mec_books,
'posts_per_page'=>-1,
'post_status'=>array('publish', 'pending', 'draft', 'future', 'private'),
'year'=>2020,
'monthnum'=>05,
'day'=>20,
'meta_query'=>array
(
array('key'=>'mec_event_id', 'value'=>$event_id, 'compare'=>'='),
array('key'=>'mec_ticket_id', 'value'=>$ticket_id, 'compare'=>'='),
array('key'=>'mec_verified', 'value'=>'-1', 'compare'=>'!='), // Don't include canceled bookings
)
));
Такой запрос находит очень много записей, хотя в базе примерно 3к записей для этого post_type
SELECT
*
FROM
wp_posts AS p
LEFT JOIN wp_postmeta AS pm
ON
pm.meta_key = 'mec_event_id' AND pm.meta_value = 28222
WHERE
p.post_type = 'mec-books' AND p.post_status IN(
'publish',
'pending',
'draft',
'future',
'private'
)