I've created archive pages for all my taxonomies (taxonomie-{taxonomy-name}.php) and this works fine. The slug of my taxonomies are the same as the slug of it's post-type. This makes it possible to create neat hierarchy in the URL, for example:

When post-type products has 'type' as a taxonomy with the values book, cd and dvd. post-type1 has the slug product and taxonomy1 has the same slug: product.

This way I can list the taxonomy-archives in the following way:




and this works great. However: the pagination works on the products archives but on the products/{type} archive it gives a 404.

Any clue?

Code of the taxonomy template is as follows:

  <?php get_header(); ?>
  <section id="inhoud" class="hfeed">
    <nav class="navigatiebalk">
      <ul class="pagina-navigatie">
        <li class="volgende-pagina"><?php previous_posts_link(''); ?></li>
        <li class="vorige-pagina"><?php next_posts_link(''); ?></li>

    <?php while ( have_posts() ) : the_post(); ?>
    $post_type = get_post_type( get_the_ID() );
        <article class="hentry publicaties artikel <?php echo $post_type ?>">
            <header class="artikel-hoofd">
            <?php the_title( '<h1 class="titel"><span class="datum date">' . the_date('d.m.y', '', '', false) . '</span><a href="' . get_permalink() . '" title="' . the_title_attribute( 'echo=0' ) . '" rel="bookmark">', '</a></h1>' ); ?>
            <figure class="icoontje"></figure>

            <section class="inleiding">
                <figure class="bericht-icoon"><?php $large_image_url = wp_get_attachment_image_src( get_post_thumbnail_id(), 'large'); echo '<a href="' . $large_image_url[0] . '" class="thumbnail-link colorbox" rel="lightbox" title="' . the_title_attribute('echo=0') . '" >'; the_post_thumbnail('thumbnail', array('class' => 'artikel-thumbnail')); ?></a>
                <span><?php $this_excerpt = get_the_excerpt(); echo $this_excerpt; ?>...&nbsp;<a href="<?php the_permalink(); ?>" class="lees-verder">Lees en luister</a>
    <?php endwhile; ?>
    <nav class="navigatiebalk">
      <ul class="pagina-navigatie">
        <li class="volgende-pagina"><?php previous_posts_link(''); ?></li>
        <li class="vorige-pagina"><?php next_posts_link(''); ?></li>
  <?php get_footer(); ?>
  • Whats the code on that page look like? – Bainternet Feb 20 '11 at 6:03
  • tnx! just updated my post – grrrbytes Feb 20 '11 at 10:28

Figured it out myself. Apparently, the pagination break because both my 'products' and my 'types' (those are not the terms I have, just for demonstration purposes) are having the same slug. Products has a slug of 'products' and types has a slug of 'products/%typename%'. Due to this I can make my permalinks hierarchical: products/dvd or products/cd. It worked, although, it broke both my pagination on taxonomy archive-pages as it broke my permalinks to individual post-types. What I did was the following to fix it:

function add_rewrite_rules($rules) {
    $newrules['([^/]+)/([^\.]+).html$'] = 'index.php?$matches[1]=$matches[2]';
    $newrules['([^/]+)/([^/]+)/page/?([0-9]{1,})/?$'] = 'index.php?post_type=$matches[1]&locations=$matches[2]&paged=$matches[3]';

    $rules = $newrules + $rules;
    return $rules;

add_filter('rewrite_rules_array', 'add_rewrite_rules');

I added some mod-rewrite rules so apache will find the paginated taxonomy archive and the individual archive-post.

| improve this answer | |
  • After 2 days, THIS is the only thing that worked for me. THANK YOU! THANK YOU! THANK YOU! – Courtney Ivey Dec 30 '11 at 9:46

If I am understanding you correctly, then you have a taxonomy named "type" defined on your site. This will break all sorts of things. "Type" is one of the reserved terms and should not be used for taxonomies.

| improve this answer | |
  • ah, no. this was just for demonstration purposes.... so products/page/2 works, but products/dvd/page/2 doesn't... – grrrbytes Feb 20 '11 at 10:25

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.