Filter
rpress_default_dietary_terms
On this page
Filters the dietary label terms created on first run.
Runs in rpress_seed_default_dietary_terms() on init (priority 11). The default list is Vegetarian, Vegan, Gluten-free, Dairy-free, Nut-free, Halal, Kosher and Spicy. Missing terms are created in the dietary taxonomy, and duplicate unused terms are removed. The seeding happens once, guarded by the rpress_dietary_seeded option.
Parameters#
| Parameter | Type | Description |
|---|---|---|
$defaults | string[] | Term names to create. |
Return value#
string[]. The term names to create.
Example#
add_filter( 'rpress_default_dietary_terms', 'my_default_dietary_terms', 10, 1 );
function my_default_dietary_terms( $defaults ) {
$defaults[] = 'Pescatarian';
return $defaults;
}
Notes#
Once the rpress_dietary_seeded option equals '2' the function returns early, so the filter has no effect on sites that have already been seeded.
Source#
Applied in:
includes/post-types.php(line 345), inrpress_seed_default_dietary_terms()
See also#
Was this page helpful?
