Which template name to use for taxonomies but not their terms?

There is no such hierarchy in WordPress, accessing a custom taxonomy directly simply 404. This works for all taxonomies, build-in or not. There is unfortuantely no other work around to this but to create a page

You should create a custom page template with a custom query to list your taxonomy terms, something like the following

  • Create a page template called page-device.php

  • Use get_terms() to create your list, something like this: (Extend as needed, taken from the get_terms() page)

    $terms = get_terms( 'device' );
    if ( ! empty( $terms ) && ! is_wp_error( $terms ) ){
        echo '<ul>';
            foreach ( $terms as $term ) {
                echo '<li>' . $term->name . '</li>';
            }
        echo '</ul>';
    }
    
  • Create a page in the back-end with slug device

Now, if you visit mysite.com/device/, you will see this page showing up with all your terms in the taxonomy device

Leave a Comment