Skip to content
Docs
Get RestroPress

Filter

rpress_fooditem_labels

Updated
On this page

Filters the labels of the fooditem (menu item) post type.

Runs when the post types are registered on init, before register_post_type() for 'fooditem'. The default labels contain sprintf placeholders: %1$s is replaced by the singular name and %2$s by the plural name from rpress_get_label_singular() and rpress_get_label_plural(). Every value is passed through sprintf() after the filter, so a literal percent sign must be written as %%.

Parameters#

ParameterTypeDescription
$fooditem_labelsarrayLabel key => string, e.g. 'name', 'singular_name', 'add_new_item', 'menu_name'.

Return value#

array. The labels array.

Example#

add_filter( 'rpress_fooditem_labels', 'my_fooditem_labels', 10, 1 );
function my_fooditem_labels( $fooditem_labels ) {
	$fooditem_labels['add_new_item'] = __( 'Add a new %1$s to the menu', 'my-plugin' );
	return $fooditem_labels;
}

Notes#

To rename the menu item type everywhere, filter rpress_default_fooditems_name instead.

Source#

Applied in:

  • includes/post-types.php (line 23), in rpress_setup_rpress_post_types()

See also#

Was this page helpful?