Exclude (or include) events based on custom field value
-
I would like to be able to exclude or include events based on the value of a custom field dat I created. There is no option to pass it as an argument to the shortcode [events], right?
If I could do that I could use something like this:
add_filter( 'event_manager_get_listings', 'filter_by_ongoing_field_query_args', 10, 2 ); function filter_by_ongoing_field_query_args( $query_args, $args ) { if ($args->custom_field === "somevalue") : $query_args['meta_query'][] = array( 'key' => '_custom_field', 'value' => 'somevalue', 'compare'=>'NOT EXISTS', ); endif; return $query_args; }Does anyone have ideas how to pass the variable so I can filter the events listing?
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
The topic ‘Exclude (or include) events based on custom field value’ is closed to new replies.