Support

Account

Home Forums ACF PRO ACF Pro Relationship field and tribe_events Reply To: ACF Pro Relationship field and tribe_events

  • You can modify the relationship field’s query with this ACF filter.

    It’s been awhile since I’ve worked with The Events Calendar but it’d likely be something comparable to:

    // change relationship field name in filter
    add_filter('acf/fields/relationship/query/name=your_relationship_field_name', 'prefix_events_relationship_query', 10, 3);
    function prefix_events_relationship_query( $args, $field, $post_id ) { 
        $today = date('Y-m-d');
    
        $args['meta_query'] = array(
          array(
            'key' => '_EventStartDate',
            'value' => $today,
            'compare' => '>=',
          )
        );
    
        return $args;
    }

    You may need to adjust the start date custom field name or the date format of today’s date but this is the general direction you’d head.