I am using the relationship field to grab events (tribe_events), right now it grabs all the events (past and upcoming), is there a query I can use for the relationship field that will grab only upcoming 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.
This worked perfectly. Thank you!