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

Isn't there a permalink structure that will essentially list out all categories of a certain post type?

function create_faqs_post_type() {
    register_post_type( 'faqs',
            'labels' => array(
                'name' => __( 'FAQs' ),
                'singular_name' => __( 'FAQ' )
        'public' => true,
        'menu_position' => 5,
        'rewrite' => array('slug' => 'the-faqs')
add_action( 'init', 'create_faqs_post_type' );

function create_faq_taxonomy() {
            'hierarchical' => true,
            'label' => 'FAQs Categories',
            'query_var' => true
add_action( 'init', 'create_faq_taxonomy' );

This is the code I've using to register the custom post type faqs and then register a taxonomy for it.

Isn't there a permalink structure that will essentially automatically list out all faqs of a certain taxonomy? Or do I need to create a custom template and query it specifically?

share|improve this question
up vote 1 down vote accepted


You can do a permalink rewrite when you register the taxonomy using the following:

'rewrite' => array( 'slug' => 'faqcategories', 'with_front' => false ),

Then site.com/faqcategories should pull them and site.com/faqcategories/easy should get them for you for the 'easy' term.

If I'm understanding you correctly.

share|improve this answer
So let's say I have a CPT called Books ... then I have a taxonomy called Genre and a genre of Horror ... What I'm essentially trying to do is find out if I can list all "horror" books on a single page without having to create a custom Template for that query. mysite.com/books/horror <- shows all books associated with the Horror taxonomy. – dcolumbus Mar 26 '12 at 3:32
Christopher? Are you still around? – dcolumbus Apr 3 '12 at 2:26
Sorry, been hiking. Jonathan Christopher did a good write up on this a while ago. You can find it here: mondaybynoon.com/20110520/…. Note that the taxonomy should be registered before the post type (that screwed me up in the past). – Christopher Apr 7 '12 at 16:59
What on earth? I've ALWAYS registered the CPT before registering the associated Taxonomy. What does that cause? – dcolumbus Apr 17 '12 at 17:25

You can use something like this:

$catArgs = array(
        // post_type isn't a valid argument, no matter how you use it.
$categories = get_categories('taxonomy=faqs_categories&post_type=faqs'); ?>
<?php foreach ($categories as $category) : ?>
  <div class="faqs-cat"><?php echo $category->name; ?></div>
    $postArgs = array(
        'orderby' => 'title',
        'order' => 'ASC',
        'tax_query' => array(
                    'taxonomy' => 'faqs_categories'
     query_posts($postArgs) ?>
         <?php while(have_posts()): the_post(); ?>
        <li><a><?php the_title() ?></a></li>
         <?php endwhile; ?>
<?php endforeach; ?>
<?php wp_reset_query();

Edited but original source here. Good luck, I hope this helps.

share|improve this answer
Okay, yeah... so there's no permalink structure that will give me the result I'm looking for. It's going to have to be a custom template? – dcolumbus Mar 26 '12 at 3:17
You could possibly implement this as a filter, but I don't know of any other ways, however I'm not saying that there isn't an alternative. I've had to use this implementation a handful of times, as I haven't found a quicker alternative. Cheers – David Mar 26 '12 at 3:21

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.