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.
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Cookie Policy. If you continue to use this site, you consent to our use of cookies.