Support » Plugin: WP REST Filter » Filter By Date Range / Have Multiple Filters At Once?

  • Resolved Logan Carlile

    (@lcarlile)


    I am developing an events application using the REST API and have a filter option to filter by month. The events post type has an ACF field that is used to set the date for the event.

    Is it possible with this plugin to have a date range / multiple filters at once? So it would still compare against the same meta_key, but would have two different met_values and meta_compares to compare against the set meta_key?

Viewing 2 replies - 1 through 2 (of 2 total)
  • Hi,
    its been marked as resolved,
    if so can you share the api call for date range,
    am face the same thing, I want to filter data based on from to
    this my api call, it give the from is fine, but till To it’ not working displaying data behind to

    https://www.xxxx.com/wp-json/wp/v2/xxx?xxx=164&_embed&per_page=10&filter[meta_key]=time&filter[meta_compare]=>&filter[meta_value]=2019-01-01T00:00:00&filter[meta_key]=time&filter[meta_compare]=<&filter[meta_value]=2019-12-31T23:59:00

    • This reply was modified 2 months, 2 weeks ago by hallbird.
    • This reply was modified 2 months, 2 weeks ago by hallbird.
    Damon Cook

    (@colorful-tones)

    I’m struggling with this as well and wish the solution was posted (if there was one).

    This gives me 8 results:

    https://domain.com/wp-json/wp/v2/event?filter[meta_key]=event_start_date&filter[meta_value]=20191128&filter[meta_compare]=>

    And this gives me 4 results:

    https://domain.com/wp-json/wp/v2/event?filter[meta_key]=event_end_date&filter[meta_value]=20191204&filter[meta_compare]=<

    And this gives me 0 results:

    https://domain.com/wp-json/wp/v2/event?filter[meta_query][0][key]=event_start_date&filter[meta_query][0][value]=20191128&filter[meta_compare][0]=>&filter[meta_query][1][key]=event_end_date&filter[meta_query][1][value]=20191227&filter[meta_compare][1]=<

    • This reply was modified 3 weeks, 3 days ago by Damon Cook.
    • This reply was modified 3 weeks, 3 days ago by Damon Cook.
    • This reply was modified 3 weeks, 3 days ago by Damon Cook.
    • This reply was modified 3 weeks, 3 days ago by Damon Cook.
Viewing 2 replies - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.