• Nimesh

    (@nimeshrathod1gmailcom)


    hello,

    I have use the query like this:

    $args = array('post_type' => 'event', 'meta_query' => array(array(
    'key' => $current_date,
    'value' => array('_event_start_date','_event_end_date'),
    'compare' => 'BETWEEN',
    'type' => 'DATE')));
    

    but it give me blank result where as i have record between start and end date..!!!

Viewing 3 replies - 1 through 3 (of 3 total)
  • The array passed to value needs to be the two values you want to compare between.

    Can you describe what you’re trying to achieve? Might make it easier to offer solutions.

    Thread Starter Nimesh

    (@nimeshrathod1gmailcom)

    sure jacob,

    I have many events with its start and end date like
    event 1 = 2017-11-08 to 2017-11-11
    event 2 = 2017-11-09 to 2017-11-10
    event 3 = 2017-11-06 to 2017-11-07

    as I have run one loop from
    2017-11-05 to 2017-11-15

    now suppose I will reach at date 2017-11-09 than, I have to display records which has this date: so my output event will be :
    event 1
    event 2

    Moderator bcworkz

    (@bcworkz)

    Looks OK AFAICT. I’ve often found it helpful to hook the “posts_request” filter and output the passed query string for analysis. This often brings to light issues that are otherwise unseen. Hopefully this helps.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘between not work in wp_query’ is closed to new replies.