Skip to content
Docs
Get RestroPress

Filter

rpress_fooditem_tax_class

Updated
On this page

Filters the tax class of a menu item.

Returned by rpress_get_fooditem_tax_class(). The default is the menu item's own tax class, then the first category class found, then standard. The value should be a slug from rpress_get_tax_classes(); an unknown slug will fail when the rate is looked up.

Parameters#

ParameterTypeDescription
$classstringTax class slug.
$fooditem_idintMenu item ID.

Return value#

string. Tax class slug.

Example#

function my_fooditem_tax_class( $class, $fooditem_id ) {
	if ( has_term( 'alcohol', 'food-category', $fooditem_id ) ) {
		return 'standard';
	}
	return $class;
}
add_filter( 'rpress_fooditem_tax_class', 'my_fooditem_tax_class', 10, 2 );

Notes#

The post type behind menu items is fooditem and its category taxonomy is food-category.

Source#

Applied in:

  • includes/tax-functions.php (line 240), in rpress_get_fooditem_tax_class()

See also#

Was this page helpful?