Ask your WordPress questions! Pay money and get answers fast! Comodo Trusted Site Seal
Official PayPal Seal

Custom Taxonomies ->Pagination ends in 404 WordPress


Hello everybody!

I know, that there is already another threat with almost this title.

But that one is already closed, so I just created this one by myself. The problem is exact the same:

I have some custom taxonomies registered and on a page I have the following code to display just the posts of a specified taxonomy-term (in this case the name of the taxonomy is "workcat" and the term is "design")

* The template for displaying Category Archive pages.
* @package WordPress
* @subpackage joeybottle_v2
* @author Dennis Winter

get_header(); ?>

//list terms in a given taxonomy using wp_list_categories (also useful as a widget if using a PHP Code plugin)

$taxonomy = 'workcat';
$orderby = '-count';
$show_count = 1; // 1 for yes, 0 for no
$pad_counts = 0; // 1 for yes, 0 for no
$hierarchical = 1; // 1 for yes, 0 for no
$title = '';

$args = array(
'taxonomy' => $taxonomy,
'orderby' => $orderby,
'show_count' => $show_count,
'pad_counts' => $pad_counts,
'hierarchical' => $hierarchical,
'title_li' => $title,
'exclude' => '6,10,11'

<ul class="horizontallist">
<li><a href="index.php/work">View All</a></li>
<?php wp_list_categories($args); ?>

<?php include (TEMPLATEPATH . '/searchform.php'); ?>


<div id="twentyleft">

<?php $term = get_term_by( 'slug', get_query_var( 'term' ), get_query_var( 'taxonomy' ) ); ?>
<?php $paged = (get_query_var('paged')) ? get_query_var('paged') : 1; ?>

<?php query_posts( array(
$term->taxonomy => $term->name,
'post_type' => 'work',
'post_status' => 'publish',
'posts_per_page' => '2',
'paged' => '$paged'
)); ?>

<?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>

<div class="workposts">
<div><a href="<?php the_permalink() ?>" title="<?php the_title() ?>" class="linked"><?php $image = get_post_meta($post->ID, "Image1", true); echo $image; ?></a></div>
<h3><a href="<?php the_permalink() ?>" title="<?php the_title() ?>" class="linked"><?php the_title() ?></a></h3>
<?php $subtitle = get_post_meta($post->ID, "Subtitle", true); echo $subtitle; ?>

<?php endwhile; else: ?>

<p><?php _e('Sorry, no posts matched your criteria.'); ?></p>

<?php endif; ?>

<div class="navigation">
<?php navi(); ?>
</div><!-- twentyleft END -->

<?php get_footer();?>

The name of the file is "taxonomy-workcat.php". Everything works fine, but the second and higher pages do not work!!! So you can go to:

But not to:

Then you get an 404 error as you can see. I really already tried the different codes and methods from this threat:

But nothing has solved the problem for now. So I posted here my actually real links so you guys can have a real look at my problem! I was searching for weeks now and nobody in the whole Internet could help me until now. So you are my last chance!!!

Thank you soooooo much already and I hope you can lead me to the solution.


Answers (2)


Cosmin Popovici answers:

I had a similar issue with WP not being able to display 2 level taxonomies.

Check out my post on ThemeForest: [[LINK href=""]][[/LINK]]

Goermez Wuff comments:

Thank you very much for that fast answer. I read through the whole threat with the link you posted here. Also through almost every link which is linked in that threat again. So I read a lot. And I tried a lot, but nothing has helped so far.

In the Link you posted are a lot of different suggestions mentioned. Maybe you could tell me which exact thing helped you out...would be great!


Chris Bavota answers:

There is a weird bug with WordPress that ends up causing a 404 if the posts_per_page variable is set to something that is different than the actual posts per page you have set in the WordPress Reading Settings in your wp-admin.

Just to test, change that to two, and your 404 will probably go away.

So the solution is to either change your posts_per_page variable or change the WordPress setting.

Goermez Wuff comments:

Thank you very much! I already had tried this tip. Now I tried it again really exactly and slow. So I tried it either way, setting it in the WP-Backend and also setting it on the "taxonomy-workcat.php"-Template. I also checked out to flash the permalinks in WP by clicking the "Save" button in the "wp-admin/settings/permalinks"-Settings. It did not help me out :(