Skip to content
Docs
Get RestroPress

Filter

rpress_menu_schema_data

Updated
On this page

Filters the Restaurant schema array before it is encoded and cached.

Runs at the end of RPRESS_Menu_Schema::data(), only when at least one menu item was described. The array is the schema.org Restaurant, with the menu under hasMenu. Add or change keys here to extend the JSON-LD. The result is cast to an array and then cached, so the change shows up after the cache is next rebuilt.

Available since RestroPress 3.5.

Parameters#

ParameterTypeDescription
$restaurantarrayRestaurant schema array.

Return value#

array. Restaurant schema array.

Example#

function my_menu_schema_data( $restaurant ) {
	$restaurant['servesCuisine'] = 'Italian';
	return $restaurant;
}
add_filter( 'rpress_menu_schema_data', 'my_menu_schema_data' );

Source#

Applied in:

  • includes/features/qr-schema/class-rpress-menu-schema.php (line 435), in RPRESS_Menu_Schema::data()

See also#

Was this page helpful?