Skip to content
Docs
Get RestroPress

Filter

rpress_reservation_slot_capacity

Updated
On this page

Filters the number of seats available in a reservation time slot.

Runs for every slot built by rpress_reservation_get_slots(). The default is the Seats per time slot setting. The remaining seats shown to guests are this value minus the covers already held by active reservations in that slot, so it can be used for per-day or per-time capacity.

Parameters#

ParameterTypeDescription
$valueintDefault seats per slot.
$tsintSlot start as a Unix timestamp.
$datestringDate being calculated (Y-m-d).

Return value#

int. Seats available in this slot.

Example#

function my_reservation_slot_capacity( $capacity, $ts, $date ) {
	// Fewer seats on Saturdays.
	if ( 6 === (int) wp_date( 'N', $ts ) ) {
		return 12;
	}
	return $capacity;
}
add_filter( 'rpress_reservation_slot_capacity', 'my_reservation_slot_capacity', 10, 3 );

Notes#

The first argument is the capacity value taken from the settings array. The result is cast to int.

Source#

Applied in:

  • includes/features/reservations/functions.php (line 254), in rpress_reservation_get_slots()

See also#

Was this page helpful?