Skip to content
Docs
Get RestroPress

Filter

rpress_reservation_submit_data

Updated
On this page

Filters the reservation data read from the submitted form.

Runs in rpress_reservation_handle_submit() after the core fields (date, slot, party, name, phone, email, note) are read from the posted form and cast to strings. Extensions use it to add their own posted fields; the full posted data is available as $input, and it is later passed on to rpress_reservation_validation_errors and rpress_reservation_insert_meta. Core fields are sanitized by the validation step, so values added here must be sanitized by the callback.

Available since RestroPress 3.5.

Parameters#

ParameterTypeDescription
$dataarrayCore fields as strings: date, slot, party, name, phone, email and note.
$inputarrayRaw unslashed $_POST.

Return value#

array. The reservation data to validate and store.

Example#

function my_reservation_submit_data( $data, $input ) {
	$data['occasion'] = isset( $input['my_occasion'] ) ? sanitize_text_field( $input['my_occasion'] ) : '';
	return $data;
}
add_filter( 'rpress_reservation_submit_data', 'my_reservation_submit_data', 10, 2 );

Source#

Applied in:

  • includes/features/reservations/frontend.php (line 174), in rpress_reservation_handle_submit()

See also#

Was this page helpful?