Support

Account

Home Forums Add-ons Repeater Field Dates in a repaeter field as a query criterium

Helping

Dates in a repaeter field as a query criterium

  • Hi there,

    First of all congratulations and thanks for this mighty plugin.

    I would like to ask your help in a very specific case :
    I have custom posts EVENTS (“evenement”) with a custom taxo ‘la_saison’

    Requesting simply on these criteria works just fine.
    These csutom posts have a repeater field : “event_dates_vente”
    These repeater contains among other stuff a date field “event_date”

    I need queries to fetch :

    all events in the future
    all events in a specific month

    Could you help me there ?
    In code, I’m trying to get all events in the future like this : :
    // args
    $args = array(
    ‘post_type’ => ‘evenement’ ,
    ‘lasaison’ => $saison_en_cours,
    ‘numberposts’ => -1,
    ‘meta_query’ => array(
    array(
    ‘key’ => ‘event_dates_vente_%_event_date’,
    ‘compare’ => ‘>’,
    ‘value’ => time(),
    )
    )
    );

    // get results
    $the_query = new WP_Query( $args );

    Thanks in advance for all the help you’ll be able to provide there,
    Cheers,

  • You can’t use WP_Query to query based on repeater sub-fields. See this page for more information: http://www.advancedcustomfields.com/resources/querying-the-database-for-repeater-sub-field-values/

Viewing 2 posts - 1 through 2 (of 2 total)

The topic ‘Dates in a repaeter field as a query criterium’ is closed to new replies.