I switched my site from categories to taxonomies for my custom post but I am having trouble getting it to work the same way. For categories I could have templates named something like category-travel.php and then have my loop in that file. Now I am trying to replace the category list with something like this :

$taxonomy = 'Gallery';
$orderby = 'name';
$show_count = 0;
$pad_counts = 0;
$hierarchical = 1;
$title = '';

$args = array (
    'taxonomy' => $taxonomy,
    'orderby' => $orderby,
    'show_count' => $show_count,
    'pad_counts' => $pad_counts,
    'hierarchical' => $hierarchical,
    'title_li' => $title

wp_list_categories($args) ?>

and in functions

register_taxonomy( 'Gallery', array( 'photo' ), array( 'hierarchical' => true, 'label' => 'Galleries', 'singular_label' => 'Gallery', 'rewrite' => true ) );

Now when I link from that generated list, something like mysite.com/gallery/name it is instead calling the archive.php rather than the taxonomy-gallery.php file I created. What am I doing wrong?

Sorry if this is a duplicate but I think that question is for something different and I cant believe that you would have to do a hack for this.

1 Answer 1


It looks like your issue is the name of your taxonomy has a capital letter, the first argument of register_taxonomy is to be all lowercase, no spaces as the documentation for the register_taxonomy function mentions here.

Change your code to the following and your taxonomy-gallery.php template will work correctly.

register_taxonomy( 'gallery', array( 'photo' ), array( 'hierarchical' => true, 'label' => 'Galleries', 'singular_label' => 'Gallery', 'rewrite' => true ) );

In the first bit of code you posted, you will also want to change the reference to the gallery taxonomy to be lowercase as well. Labels are fine with any case, but not actual names of taxonomies.

  • Ahh thanks! I had that page open one tab over but obviously did not read it very carefully. Appreciate the help!
    – zac
    May 8, 2012 at 3:43
  • No worries man. Simple things like that always happen to the best of us, I've been tricked up like that many times. May 8, 2012 at 23:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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