WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I made a custom post type called Product. And a taxonomy with the name 'product-category'. These taxonomies have pages where we show a list of the products that have that taxonomy.

Now my question is how to get all the taxonomies as a menu in the header. Its an awful lot of work to add it manually in the menu editor. Also because i need sub-menu's and sub sub menu's. How do I do this?

share|improve this question
up vote 1 down vote accepted

You can use wp_list_categories() which by default, generates nested unordered lists (ul) and just pass product-category as the taxonomy parameter for example:

add_filter('wp_nav_menu_items','add_custom categories', 10, 2);
function add_custom categories($items, $args) {

    $items .= '<li>' . wp_list_categories( array('echo' => 0, 'taxonomy' => 'product-category', 'title_li' => 'Product Categories') ) . '</li>';
    return $items;
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.