Skip to content
Docs
Get RestroPress

Filter

rpress_get_taxonomy_labels

Updated
On this page

Filters the name labels returned for a menu taxonomy.

Runs at the end of rpress_get_taxonomy_labels() with the array of 'name', 'singular_name' and 'menu_name' labels read from the registered taxonomy. The array is empty when the taxonomy is not registered.

Parameters#

ParameterTypeDescription
$labelsarrayArray with 'name', 'singular_name' and 'menu_name'.
$taxonomyWP_Taxonomy|falseThe taxonomy object returned by get_taxonomy(), or false when it is not registered.

Return value#

array. The labels array.

Example#

add_filter( 'rpress_get_taxonomy_labels', 'my_taxonomy_menu_label', 10, 2 );
function my_taxonomy_menu_label( $labels, $taxonomy ) {
	if ( $taxonomy && 'addon_category' === $taxonomy->name ) {
		$labels['menu_name'] = __( 'Extras', 'my-plugin' );
	}
	return $labels;
}

Notes#

The $taxonomy argument is the taxonomy object, not the slug the function was called with.

Source#

Applied in:

  • includes/post-types.php (line 401), in rpress_get_taxonomy_labels()

See also#

Was this page helpful?