In wordpress I have only publish_date(not meta_key) and meta_key "end_date"
Example: event from 2015-06-22(publish_date) to 2015-08-24(meta_ket = "end_date")
now I want search all events
(from 2015-07-05 to 2015-07-24)
or
(from 2015-08-05 to 2015-09-25)
and must show event in example
This code not work:
$opt = array(
'post_type' => 'event_info',
'posts_per_page' => '40',
'paged' => $page_num,
'orderby' => 'post_date ID',
'order' => 'DESC',
'relation' => 'OR',
'meta_query' => array(
'key' => 'end_date',
'value' => array('$date_start','$date_end'),
'compare' => 'BETWEEN',
'type' => 'numeric'),
'date_query' => array(
array(
......
'compare' => 'BETWEEN',
),
),
)
);
relation between meta key and data_query not work, current idea is create 2 query but I dont want do this
try this : here I added timestamp in startdate and enadate meta key