Skip to content
WXP Plugins

Plugins

WXP Restaurant Menu

WXP Opening Times

WXP Local Events

WXP Restaurant Reservations

Demo

Pricing

Support

Docs

FAQ

Buy

Menu

Plugins

- WXP Restaurant Menu

- WXP Opening Times

- WXP Local Events

- WXP Restaurant Reservations

Demo

Pricing

Support

- Docs

- FAQ

Buy

WXP Opening Times

8
  • Installation
    • Installing WXP Opening Times
  • Basic operations
    • Creating your (first) schedule
    • Setting exceptions
  • For developers
    • Filter- and action hooks
    • Twig templates
    • WXP Opening Times shortcodes
  • Jewish and Islamic holidays
    • Installation
      • Installing WXP Opening Times: Jewish and Islamic holidays
    • For developers
      • Jewish and Islamic holidays: for developers

WXP Restaurant Menu

11
  • Installation
    • Installing WXP Restaurant Menu
  • Basic operations
    • Understanding the concept
    • The Settings for the WXP Restaurant Menu Plugin
    • The Icon menu
    • The Sets Menu
    • The Tags Menu
    • The Groups Menu
    • The Categories menu
  • For developers
    • Filter- and action hooks
    • Twig templates
    • WXP Restaurant Menu shortcodes

WXP Local Events

8
  • Installation
    • Installing WXP Local Events
  • For developers
    • Filter- and action hooks
    • Twig templates
    • WXP Local Events shortcodes
  • Local Events for WooCommerce
    • Installation
      • Installing WXP Local Events for WooCommerce
    • For developers
      • Local Events for WooCommerce: for developers
  • Events Feed
    • Installation
      • Installing WXP Events Feed
    • For developers
      • Events Feed: for developers

WXP Restaurant Reservations

6
  • Installation
    • Installing WXP Restaurant Reservations
  • For developers
    • Filter- and action hooks
    • Twig templates
    • WXP Restaurant Reservations shortcodes
  • Rooms
    • Installation
      • Installing WXP Restaurant Bookings: Rooms
    • For developers
      • Rooms: for developers

General Developer Information

1
  • Twig
    • Twig templates in the WXP plugins

WXP Agency Kit

1
  • WXP Agency Kit: demo content from the command line
View Categories
  • Home
  • Documentation
  • WXP Restaurant Reservations
  • For developers
  • Filter- and action hooks

Filter- and action hooks

5 min read

0:00 / 7:03
  • View as Markdown Open this page as plain Markdown (opens in a new tab)
  • Open in ChatGPT Ask questions about this page (opens in a new tab)
  • Open in Claude Ask questions about this page (opens in a new tab)
  • Open in Google AI Studio Ask questions about this page (Google account required) (opens in a new tab)

WXP Restaurant Reservations offers filters to change the mails, the booking form, the templates, the rate limit and the name of the database tables, and actions that tell your code when a reservation is made, changed or mailed. All names start with wxp_rr_.

How to use a hook #

A filter receives a value, can change it and must return it. An action tells you that something happened, and returns nothing. Add your code to the functions.php of your child theme, or to a small plugin of your own. The last number of add_filter() and add_action() is the number of arguments your function receives; ask for as many as you need.

add_filter( 'hook_name', function ( $value, $extra ) {
	// Change $value here.
	return $value;
}, 10, 2 );

add_action( 'hook_name', function ( $first, $second ) {
	// React here.
}, 10, 2 );

Overview #

Hook Type What it does
wxp_rr_reservation_created Action Fires after a reservation was made.
wxp_rr_reservation_updated Action Fires after a reservation was changed (details, table or status).
wxp_rr_reservation_modified Action Fires after the time, the party size or the number of kids of a reservation changed. The guest mail about the change is sent from this hook.
wxp_rr_reservation_status_changed Action Fires after the status of a reservation changed: seated, completed, cancelled or no-show.
wxp_rr_mail_enabled Filter Decides whether a mail is sent.
wxp_rr_mail_message Filter Changes the message before it is sent.
wxp_rr_mail_sent Action Fires after a mail was handed to wp_mail().
wxp_rr_restaurant_name Filter Changes the restaurant name used in the mails. The default is the title of the site.
wxp_rr_consent_text Filter Changes the text next to the consent checkbox of the booking form.
wxp_rr_template_context Filter Changes the data passed to a reservation template.
wxp_rr_template_paths Filter Changes the folders where templates are looked for, in lookup order. The folders of your (child) theme come before the templates folder of the plugin.
wxp_rr_twig_cache Filter Sets a folder for the compiled templates. Caching is off by default.
wxp_rr_load_css Filter Decides whether the plugin loads its own stylesheet. Return false to use your own CSS.
wxp_rr_rate_limit Filter Changes how often a visitor may use the public routes of the booking form.
wxp_rr_client_ip Filter Changes the address that is rate limited. Behind a proxy or a CDN, return the address of the real visitor.
wxp_rr_table_prefix Filter Changes the prefix of the database tables of the plugin. The default is the WordPress prefix followed by wxp_rr_. This is meant for tests; do not change it on a site with reservations, because the plugin then looks at other tables.

Actions: reservations #

wxp_rr_reservation_created #

Action. Fires after a reservation was made.

Argument Type Description
$reservation Reservation The new reservation.
add_action( 'wxp_rr_reservation_created', function ( $reservation ) {
	// Tell your own system about the new reservation.
} );

wxp_rr_reservation_updated #

Action. Fires after a reservation was changed (details, table or status).

Argument Type Description
$reservation Reservation The reservation after the change.

wxp_rr_reservation_modified #

Action. Fires after the time, the party size or the number of kids of a reservation changed. The guest mail about the change is sent from this hook.

Argument Type Description
$reservation Reservation The reservation after the change.
$previous Reservation The reservation as it was before.

wxp_rr_reservation_status_changed #

Action. Fires after the status of a reservation changed: seated, completed, cancelled or no-show.

Argument Type Description
$reservation Reservation The reservation after the change.
$status ReservationStatus The new status.

Actions and filters: mail #

wxp_rr_mail_enabled #

Filter. Decides whether a mail is sent.

Argument Type Description
$send bool true by default.
$type string The mail type: confirmation, changed, cancelled or venue.
$booking Reservation The reservation.

Return: true to send, false to skip.

// Do not send the mail to the restaurant itself.
add_filter( 'wxp_rr_mail_enabled', function ( $send, $type ) {
	return 'venue' === $type ? false : $send;
}, 10, 2 );

wxp_rr_mail_message #

Filter. Changes the message before it is sent.

Argument Type Description
$message array to, subject, body (HTML) and headers. An empty to cancels the mail.
$type string The mail type.
$booking Reservation The reservation.

Return: the message.

wxp_rr_mail_sent #

Action. Fires after a mail was handed to wp_mail().

Argument Type Description
$type string The mail type.
$booking Reservation The reservation.
$sent bool Whether wp_mail() accepted the mail.

wxp_rr_restaurant_name #

Filter. Changes the restaurant name used in the mails. The default is the title of the site.

Argument Type Description
$name string The name.

Return: the name.

Booking form and templates #

wxp_rr_consent_text #

Filter. Changes the text next to the consent checkbox of the booking form.

Argument Type Description
$text string The text.

Return: the text.

add_filter( 'wxp_rr_consent_text', function () {
	return 'I agree that my details are used for this reservation.';
} );

wxp_rr_template_context #

Filter. Changes the data passed to a reservation template.

Argument Type Description
$context array The template data.
$template string The name of the template.

Return: the template data.

wxp_rr_template_paths #

Filter. Changes the folders where templates are looked for, in lookup order. The folders of your (child) theme come before the templates folder of the plugin.

Argument Type Description
$paths string[] Folders.

Return: the list of folders.

wxp_rr_twig_cache #

Filter. Sets a folder for the compiled templates. Caching is off by default.

Argument Type Description
$cache string|false A folder, or false (default).

Return: a folder, or false.

wxp_rr_load_css #

Filter. Decides whether the plugin loads its own stylesheet. Return false to use your own CSS.

Argument Type Description
$load bool true by default.

Return: true or false.

add_filter( 'wxp_rr_load_css', '__return_false' );

Protection and database #

wxp_rr_rate_limit #

Filter. Changes how often a visitor may use the public routes of the booking form.

Argument Type Description
$limit array Two numbers: the attempts allowed, and the length of the window in seconds. A limit of 0 turns the limit off.
$action string The route: availability or create.

Return: the limit.

// At most 5 bookings per visitor per 10 minutes.
add_filter( 'wxp_rr_rate_limit', function ( array $limit, string $action ) {
	return 'create' === $action ? array( 5, 600 ) : $limit;
}, 10, 2 );

wxp_rr_client_ip #

Filter. Changes the address that is rate limited. Behind a proxy or a CDN, return the address of the real visitor.

Argument Type Description
$ip string The address of the visitor.

Return: the address.

add_filter( 'wxp_rr_client_ip', function ( $ip ) {
	if ( ! empty( $_SERVER['HTTP_X_FORWARDED_FOR'] ) ) {
		$parts = explode( ',', sanitize_text_field( wp_unslash( $_SERVER['HTTP_X_FORWARDED_FOR'] ) ) );
		return trim( $parts[0] );
	}
	return $ip;
} );

wxp_rr_table_prefix #

Filter. Changes the prefix of the database tables of the plugin. The default is the WordPress prefix followed by wxp_rr_. This is meant for tests; do not change it on a site with reservations, because the plugin then looks at other tables.

Argument Type Description
$prefix string The prefix.

Return: the prefix.

Good to know #

  • Demo data: the actions are not fired for the demo reservations of the importer, and never inside a database transaction.
  • Repeated requests: when a guest sends the same booking twice (for example by a double click), the second request returns the first reservation and wxp_rr_reservation_created is fired once.
  • Mails: the plugin sends its own mails from these actions. Your function runs next to them, so you can add your own handling without switching the mails off.
Updated on October 30, 2026

What are your Feelings

  • Happy
  • Normal
  • Sad

Share This Article :

  • Facebook
  • X
  • LinkedIn
  • Pinterest
WXP Restaurant Reservations shortcodesTwig templates
Table of Contents
  • How to use a hook
  • Overview
  • Actions: reservations
    • wxp_rr_reservation_created
    • wxp_rr_reservation_updated
    • wxp_rr_reservation_modified
    • wxp_rr_reservation_status_changed
  • Actions and filters: mail
    • wxp_rr_mail_enabled
    • wxp_rr_mail_message
    • wxp_rr_mail_sent
    • wxp_rr_restaurant_name
  • Booking form and templates
    • wxp_rr_consent_text
    • wxp_rr_template_context
    • wxp_rr_template_paths
    • wxp_rr_twig_cache
    • wxp_rr_load_css
  • Protection and database
    • wxp_rr_rate_limit
    • wxp_rr_client_ip
    • wxp_rr_table_prefix
  • Good to know
WXP Plugins

Demo

Pricing

© 2026 WXP Plugins. All prices are in euro, excluding VAT.

WXPPlugins is a brand of WP Digital Marketing - The Netherlands - Chamber of Commerce (KvK) 75580152