I have added 3 custom taxonomies. I would like to add the taxonomy Titles to my menu? I can add the terms but it is the actual names (Globale Nachhaltigkeit, Regionen and Medien) of the taxonomies that I want to add. Thanks in advance! This is how I have added my taxonomies.
function be_register_taxonomies() {
$taxonomies = array(
array(
'slug' => 'globale-nachhaltigkeit',
'single_name' => 'Globale Nachhaltigkeit',
'plural_name' => 'Globale Nachhaltigkeit',
'post_type' => 'post',
),
array(
'slug' => 'regionen',
'single_name' => 'Region',
'plural_name' => 'Regionen',
'post_type' => 'post',
),
array(
'slug' => 'medien',
'single_name' => 'medien',
'plural_name' => 'medien',
'post_type' => 'post',
),
);
foreach( $taxonomies as $taxonomy ) {
$labels = array(
'name' => $taxonomy['plural_name'],
'singular_name' => $taxonomy['single_name'],
'search_items' => 'Search ' . $taxonomy['plural_name'],
'all_items' => 'All ' . $taxonomy['plural_name'],
'parent_item' => 'Parent ' . $taxonomy['single_name'],
'parent_item_colon' => 'Parent ' . $taxonomy['single_name'] . ':',
'edit_item' => 'Edit ' . $taxonomy['single_name'],
'update_item' => 'Update ' . $taxonomy['single_name'],
'add_new_item' => 'Add New ' . $taxonomy['single_name'],
'new_item_name' => 'New ' . $taxonomy['single_name'] . ' Name',
'menu_name' => $taxonomy['plural_name']
);
$rewrite = isset( $taxonomy['rewrite'] ) ? $taxonomy['rewrite'] : array( 'slug' => $taxonomy['slug'] );
$hierarchical = isset( $taxonomy['hierarchical'] ) ? $taxonomy['hierarchical'] : true;
register_taxonomy( $taxonomy['slug'], $taxonomy['post_type'], array(
'hierarchical' => $hierarchical,
'labels' => $labels,
'show_ui' => true,
'show_in_nav_menus' => true,
'query_var' => true,
'show_in_rest' => true,
'rewrite' => $rewrite,
));
}
}
add_action( 'init', 'be_register_taxonomies' );