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

7
  • Installation
    • Installing WXP Restaurant Menu
  • Basic operations
    • Understanding the concept
    • The Settings for the WXP Restaurant Menu Plugin
    • The Icon 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 Menu
  • For developers
  • Filter- and action hooks

Filter- and action hooks

3 min read

0:00 / 4:43
  • 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 Menu offers filters to change the data of the menu items, the data given to the templates, the icons, the renderer and the stylesheet. It has no action hooks. All names start with wxp_restaurant_menu_.

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_restaurant_menu_item_data Filter Changes the template data of one menu item, for example to add fields. The ACF bridge of the plugin adds item.acf here. Twig escapes the values as HTML.
wxp_restaurant_menu_template_context Filter Changes the data passed to the menu template (the wxp_menu shortcode, block and widget).
wxp_restaurant_menu_selection_context Filter Changes the data passed to the template of a menu selection (the wxp_menu_selection shortcode, block and widget).
wxp_restaurant_menu_icon_svg Filter Changes the SVG of an icon reference, for example to support your own icon set. The result is cleaned with the SVG allow list of the plugin.
wxp_restaurant_menu_renderer Filter Replaces the renderer that is shared by the shortcode and the Elementor widget, for example to use another template engine than Twig.
wxp_restaurant_menu_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_restaurant_menu_twig_cache Filter Sets a folder for the compiled templates. Caching is off by default, so no files are written.
wxp_restaurant_menu_load_css Filter Decides whether the plugin loads its own stylesheet. Return false to use your own CSS.

Data #

wxp_restaurant_menu_item_data #

Filter. Changes the template data of one menu item, for example to add fields. The ACF bridge of the plugin adds item.acf here. Twig escapes the values as HTML.

Argument Type Description
$data array The data of the item.
$post WP_Post The menu item.

Return: the data of the item.

add_filter( 'wxp_restaurant_menu_item_data', function ( array $data, WP_Post $post ) {
	$data['kitchen_note'] = (string) get_post_meta( $post->ID, 'kitchen_note', true );
	return $data;
}, 10, 2 );

// In your template: {{ item.kitchen_note }}

wxp_restaurant_menu_template_context #

Filter. Changes the data passed to the menu template (the wxp_menu shortcode, block and widget).

Argument Type Description
$context array The template data.
$template string The name of the template.
$query MenuQuery The selection that is shown.

Return: the template data.

wxp_restaurant_menu_selection_context #

Filter. Changes the data passed to the template of a menu selection (the wxp_menu_selection shortcode, block and widget).

Argument Type Description
$context array The template data.
$name string The name of the template, starting with selection-.
$options SelectionOptions The settings of the selection.

Return: the template data.

wxp_restaurant_menu_icon_svg #

Filter. Changes the SVG of an icon reference, for example to support your own icon set. The result is cleaned with the SVG allow list of the plugin.

Argument Type Description
$svg string The SVG markup, empty when the icon is unknown.
$reference string The icon reference.

Return: the SVG markup.

Renderer, templates and stylesheet #

wxp_restaurant_menu_renderer #

Filter. Replaces the renderer that is shared by the shortcode and the Elementor widget, for example to use another template engine than Twig.

Argument Type Description
$renderer MenuRendererInterface The default Twig renderer.

Return: an object that implements MenuRendererInterface.

wxp_restaurant_menu_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.

add_filter( 'wxp_restaurant_menu_template_paths', function ( array $paths ) {
	array_unshift( $paths, WP_CONTENT_DIR . '/my-menu-templates' );
	return $paths;
} );

wxp_restaurant_menu_twig_cache #

Filter. Sets a folder for the compiled templates. Caching is off by default, so no files are written.

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

Return: a folder, or false.

wxp_restaurant_menu_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_restaurant_menu_load_css', '__return_false' );

Good to know #

  • Own templates: to change the layout, copy a template from the templates folder of the plugin to wxp-restaurant-menu/ in your (child) theme. You only need a hook when the template needs data that the plugin does not give.
  • Escaping: Twig escapes everything as HTML, also the values you add with wxp_restaurant_menu_item_data.
Updated on October 30, 2026

What are your Feelings

  • Happy
  • Normal
  • Sad

Share This Article :

  • Facebook
  • X
  • LinkedIn
  • Pinterest
WXP Restaurant Menu shortcodesTwig templates

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Table of Contents
  • How to use a hook
  • Overview
  • Data
    • wxp_restaurant_menu_item_data
    • wxp_restaurant_menu_template_context
    • wxp_restaurant_menu_selection_context
    • wxp_restaurant_menu_icon_svg
  • Renderer, templates and stylesheet
    • wxp_restaurant_menu_renderer
    • wxp_restaurant_menu_template_paths
    • wxp_restaurant_menu_twig_cache
    • wxp_restaurant_menu_load_css
  • 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