3

I read a lot of posts here with similar problems but nothing worked for me.

I have a custom taxonomy (portfolio_category) for my custom post type. I created a taxonomy template (taxonomy-portfolio_category.php) which works fine on first page. When I add a pagination, and try to go to an older page it leads to an 404. i'm not able to resolve the problem

Here's my code:

<?php get_header(); ?>

<?php 
        $query = new WP_Query(array(
            'posts_per_page'=> 2,
            'paged' => ( get_query_var('paged') ? get_query_var('paged') : 1 ),
            'portfolio_category' => get_query_var('portfolio_category'),
            'post_type' => array('portfolio')
        ));

        while ($query->have_posts()) { 
            $query->the_post(); get_template_part( 'loop', 'portfolio'); 
        }

        pagination();
?>

<?php get_header(); ?>

So, as said when going to any page of the taxonomy it leads to a 404 error, no matter what kin of permalink settings I have.

  • ?portfolio_category=branding&paged=2
  • /portfolio_category/branding/page/2

Wourld really appreciate some help. Thank you very much.

  • Drop the custom query and use the main default loop, that is all – Pieter Goosen Sep 8 '15 at 9:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.