I would like to create an archive page with a list of my custom taxonomies that link to a page that shows posts with that taxonomy relationship.

I registered my taxonomy like this:

register_taxonomy('my_taxo', array('my_custom_post'), array(
            'hierarchical' => true,
            'label' => 'my taxo'
            'show_ui' => true,
            'query_var' => true,
            'show_in_nav_menus ' => true

What is the recommended way to create an archive page that can be visited at a url such as mysite.com/my_taxo or mysite.com/taxonomy/my_taxo.

Ideally the template file that will be used would be taxonomy-{taxonomy}.php.

Does this involve add_rewrite_rule? If so what might that look like?

  • Could you clarify: Are you wanting a list of taxonomy terms, with a link for each that points to an archive of posts using of that term? Commented May 9, 2012 at 16:03
  • yes, I need a list of the taxonomy terms. Each term will have a link to posts with that term. The part I am stuck on is the pretty URL and using an appropriate template file.
    – Mike
    Commented May 9, 2012 at 16:04

1 Answer 1


WordPress doesn't generate an 'archive of terms' automatically. However, you're current permalink structure is set up so that:


points to the 'my-term' archive page of the 'my_taxo' taxonomy (listing all posts with the 'my-term' tag).

So what you can do is create a page with slug 'my_taxo':


Assign this page a custom template which simply lists the taxonomy terms with links.

The simpliest way would be to use wp_list_categories()

$args = array(
  'taxonomy'     => 'my_taxo',
  'orderby'      => 'name',
  'hierarchical' => 1
  'title_li'     => ''

<?php wp_list_categories( $args ); ?>

Alternatively you can use get_terms to return an array of terms in that taxonomy, which you can loop through and display the terms.

Neither will handle pagination automatically - but get_terms allows you to specify both a limit and an offset - so you could handle pagination yourself if this is necessary.

  • Great, I think I might have over thought this one. Creating a page in the admin will work just fine. We can leave the URL rewriting for another day... Thanks!
    – Mike
    Commented May 9, 2012 at 18:09
  • You shouldn't need any custom rewriting or did you want the taxonomy/my_taxi structure? Commented May 9, 2012 at 18:50
  • Well, if you wanted to avoid having to create the page in the admin for a url such as mysite.com/my-taxo I think it would require a url rewrite rule.
    – Mike
    Commented May 10, 2012 at 18:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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