Support » Fixing WordPress » Custom Taxonomy Archive shows no posts or paging is broken

  • Hi everyone,

    I think I’ve exhausted all I can do to figure this one out. I’ve also tried searching for answers and nothing has worked.

    I have a custom post type of project and a custom taxonomy of projectcat.

    I want an archive for my project category taxonomy. So I created a template file taxonomy-projectcat.php.

    Am I correct in thinking that I do not have to do any WP_Query or query_posts calls on that template in order to get any posts to appear? Right now if I just keep the normal loop, I get no posts.

    If I introduce a query_posts including arguments for post_type=project and projectcat=$term->slug, I see posts, but if I go to page 2 I get a 404?

    I have public, publicy_queryable, and has_archive set to true when registering the custom post type.

    What am I missing or is there a bug?

Viewing 6 replies - 1 through 6 (of 6 total)
  • I´m sufering the same.

    What I have a CPT = carrera and it use a TAX = modalidad. WHere modalidad have many terms, so I can´t use taxonomy-modalidad-[term].php

    http/wordpress/modalidad/diurna WORKS! 🙂 and is using taxonomy-modalidad.php


    http/wordpress/modalidad DON´T! :(I try with archive-modalidad.php

    I´ve read WP don´t have this taxonomy url, and the internet say is better to create a page with a tempalte that shows all the taxonomy terms, but in my case I can´t use that.

    Have you found a solution ?




    Yes, there is a solution. What you are doing, in theory, should work. It might be the way you are creating your taxonomy. I do this on a regular basis and don’t have any issues using taxonomy-custom_tax_name.php, without adding special code or query_posts.

    Here are the arguments I use (I left out the ‘labels’ here as those don’t matter for this purpose, but of course I use those as well):

    $args = array(
    	'public' => true,
    	'hierarchical' => true,
    	'show_ui' => true,
    	'show_in_nav_menus' => true,
    	'query_var' => true

    These few args will set ‘publicy_queryable’ and ‘has_archive’ to true, along with a bunch of other options that need to be set to true. It’s also good practice to create the taxonomy before you create the custom post. Not sure if it really makes a difference, but according to WordPress articles I’ve ready, tax should come first in the order.

    To better assist, I would need to see the code you use to create the taxonomy. Both of you.

    Moderator keesiemeijer



    By default only the term archive pages will show posts

    What you could do is create a page with the slug modalidad

    And query for all the posts in your custom taxonomy:

      $terms = get_terms('modalidad', 'fields=names');
      $args = array(
        'tax_query' => array(
            'taxonomy' => 'modalidad', // change taxonomy
            'field' => 'slug',
            'terms' => $terms
      $myquery = new WP_Query( $args);
    <?php while ($myquery->have_posts()) : $myquery->the_post();  ?>
    <!-- put the rest of your loop here -->
    <?php endwhile; ?>

    I don´t understand the reason why a taxonomy url archive template doesn´t exist in WP, the core dev must have a reason but this something really necesary, hope they include it in future releases.



    @lonchbox… What you are asking to do is not possible because a custom taxonomy can be attached to more than one post type. It would be impossible for WordPress to have a page because which posts would it show? From which post type?

    It is really easy to simply create a page that pulls all the posts you are looking for inside a taxonomy. Why can’t you do this in your case?

    And the reason archive-modalidad.php doesn’t work is because archive-whatever is for post types, not taxonomies. So you would instead use archive-carrera.php for your custom post type carrera.

    @jacorre, send me the code you use to make the custom taxonomy and I should be able to help you out. I do that sort of thing routinely, so it shouldn’t be too hard to figure out what’s going on.

    @wpismupuppet actually for the “archive” page of the taxonomy termns I´m using taxonomy-[tax_term].php and works fine. I get your point of why achive-[tax_term].php does´t work but I think is necessary, which post would it show? I think a resume of all posts in that taxonomy, but again is just an idea 😛

    At the end I create a page template with a cusotm wp_query.

    Much thanx.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Custom Taxonomy Archive shows no posts or paging is broken’ is closed to new replies.