eventorganiser_bookable_occurrences
(filter)
Pro
Filters the occurrences which are 'bookable' for a given event
'Bookable' is irrespective of whether an occurrence is fully booked, or even has any tickets.
It means, assuming there are available tickets, which dates of the given event should
be available for bookings 'now'.
By default all future occurrences are 'bookable', but you could, for instance, opt to
end bookings early:
add_filter( 'eventorganiser_bookable_occurrences', function( $bookable, $event_id ) {
$next_week = new DateTime( '+7 days', eo_get_blog_timezone() );
foreach( $bookable as $occurrence_id => $occurrence ) {
if ( $next_week > $occurrence['start'] ) {
unset( $bookable[$occurrence_id] );
}
}
return $bookable;
}, 10, 2 );
Parameters
array
|
$future |
An array of occurrences ( array with 'start' and 'end' ) keys. Defaults: to {@see eo_get_the_future_occurrences_of()}
|
int
|
$event_id |
ID of the event for which we want 'bookable' occurence IDs
|
Example Usage
add_filter( 'eventorganiser_bookable_occurrences', 'my_callback_function', 10, 2 );
function my_callback_function( $future, $event_id ){
//Change first value and return it
return $future
};
Resources