Adding a custom taxonomy to “nav_menu_item”
Question
Does anyone know if there is a way to handle a custom taxonomy for the nav_menu_item
built’in post type?
When I assign my custom taxonomy to this post type, i don’t see any change in the menu editor…
It works well with posts
, pages
and custom post types
.
Here how I’ve registered my custom taxonomy:
add_action( 'init', 'my_region_taxo', 0 );
function my_region_taxo() {
$labels = array(
'name' => _x( 'Regions', 'Taxonomy General Name', 'my-text-domain' ),
'singular_name' => _x( 'Region', 'Taxonomy Singular Name', 'my-text-domain' ),
(...)
);
$rewrite = array(
'slug' => 'region',
'with_front' => true,
'hierarchical' => true,
);
$args = array(
'labels' => $labels,
'hierarchical' => true,
'public' => true,
'show_ui' => true,
'show_admin_column' => true,
'show_in_nav_menus' => false,
'show_tagcloud' => false,
'rewrite' => $rewrite,
'show_in_rest' => true,
);
register_taxonomy(
'my_region_taxonomy',
array(
'post',
'page',
'nav_menu_item'
),
$args
);
}
0
custom-taxonomy, menus, navigation
6 years
2018-03-27T06:48:48-05:00
2018-03-27T06:48:48-05:00 0 Answers
94 views
0
Leave an answer