Skip to content
Docs
Get RestroPress

Filter

rpress_default_allergens

Updated
On this page

Filters the default allergen set seeded on install or upgrade.

Defaults to the 14 EU allergens, keyed by slug, each with a name and a short badge code. The set is created once, by slug, and terms the merchant later deletes are not recreated. Changing the list after the seed has run does not add terms unless the seed is forced.

Parameters#

ParameterTypeDescription
$allergensarrayAllergens keyed by slug, each an array with 'name' and 'code'.

Return value#

array. Allergens keyed by slug.

Example#

add_filter( 'rpress_default_allergens', 'my_default_allergens', 10, 1 );
function my_default_allergens( $allergens ) {
	$allergens['corn'] = array(
		'name' => __( 'Corn', 'my-plugin' ),
		'code' => 'CO',
	);
	return $allergens;
}

Source#

Applied in:

  • includes/features/allergens/loader.php (line 94), in rpress_allergens_default_terms()

See also#

Was this page helpful?