Skip Navigation

[Resolved] Automatically adding custom taxonomy entries to a menu

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

This topic contains 2 replies, has 2 voices.

Last updated by Keith 6 years, 11 months ago.

Assigned support staff: Caridad.


I realise that I can manually add custom taxonomies to the WP Nav menu by going to "Screen Options" and selecting from there.

Any guidance as to how I could add a custom taxonomy to a menu but have it automatically include all categories within the custom taxonomy. i.e. if I add or remove a category within the custom taxonomy, it will automatically update in the dropdown WP nav menu?


Dear Keith,

You will need to work with the 'wp_nav_menu_items' hook. This hook will receive the menu items so you can add the custom taxonomy entries and return it.

Here is an example that would add sectors submenu and works with our Toolset Bootstrap theme:


function add_my_terms($items) {
global $post;
$items .= '<li class="dropdown"><a class="dropdown-toggle" data-toggle="dropdown" href="#">Sectors</a><ul class="dropdown-menu">';
$terms = get_terms('sector');
foreach ($terms as $term) {
$items .= '<li><a href="' . get_term_link($term) . '">' . $term->name . '</a></li>';
$items .= '</ul></li>';
return $items;

You might have to adjust the code to work with your theme.

Please let me know if you are satisfied with my answer and if I can help you with any other questions you might have.



Thanks Caridad, worked perfectly for me.