Skip to content
Docs
Get RestroPress

Filter

rpress_allergens_display_mode

Updated
On this page

Filters how allergens are displayed on the menu.

The mode comes from the allergens_display setting and is one of 'all', 'badges' or 'off'. Card badges and the popup block are skipped when the mode is 'off'. Core coerces unknown saved values to 'all' before this filter runs, but the filter result is not validated.

Parameters#

ParameterTypeDescription
$modestringDisplay mode: all, badges or off.

Return value#

string. Display mode.

Example#

add_filter( 'rpress_allergens_display_mode', 'my_allergens_display_mode', 10, 1 );
function my_allergens_display_mode( $mode ) {
	return is_admin() ? 'off' : $mode;
}

Source#

Applied in:

  • includes/features/allergens/functions.php (line 126), in rpress_allergens_display_mode()
Was this page helpful?