129 posts
  • Elite Author: Sold more than $75,000 on Envato Market
  • Has sold $250,000+ on Envato Market
  • Located in Ireland
  • Made it to the Authors' Hall of Fame
+5 more
OllieMcCarthy says

Hi guys, I am at my wits end with this seemingly simple issue.

I have a custom portfolio post called “portfolio_posts” with a taxonomy of “portfolio_cats”. Now I have created a category called “illustration” and I can view its page 1 fine. The only problem is when I try to view page 2 or 3 I get a 404.

I have spent a ridiculous amount of time on this problem. I have read everything google could show on the subject, including all the threads on this forum. I’ve tried absolutely everything I could think of with no luck. Why is this so difficult?

Here’s my loop so far:


$args = array( 'post_type' => 'portfolio_posts', 'portfolio_cats' => $taxonomy_single, 'posts_per_page' => 3, 'paged' => $paged );
$loop = new WP_Query( $args );
while ( $loop->have_posts() ) : $loop->the_post();
...do stuff

Here’s my taxonomy setup:


register_taxonomy('portfolio_cats',array('portfolio_posts'), array(
     'hierarchical' => true,
     'labels' => $labels,
     'show_ui' => true,
     'query_var' => true, 
     'rewrite' => array( 'slug' => 'gallery', 'with_front'=>false),
   ));
2580 posts Put a Donk On It
  • Has referred 200+ members
  • Has sold $250,000+ on Envato Market
  • Has collected 10+ items on Envato Market
  • Elite Author: Sold more than $75,000 on Envato Market
+10 more
ThemeProvince says

Place flush_rewrite_rules(); under the register_taxonomy & register_custom_post_type functions.

129 posts
  • Elite Author: Sold more than $75,000 on Envato Market
  • Has sold $250,000+ on Envato Market
  • Located in Ireland
  • Made it to the Authors' Hall of Fame
+5 more
OllieMcCarthy says

Place flush_rewrite_rules(); under the register_taxonomy & register_custom_post_type functions.

Thanks for the suggestion. Still though, I tried it and it didn’t work

147 posts
  • Has been part of the Envato Community for over 4 years
  • Has referred 10+ members
  • Has sold $250,000+ on Envato Market
  • Has collected 10+ items on Envato Market
+2 more
FlexiPress says

don’t forget to add $paged definition ;)

$paged = (get_query_var('paged')) ? get_query_var('paged') : 1;  
$args = array( 'post_type' => 'portfolio_posts', 'portfolio_cats' => $taxonomy_single, 'posts_per_page' => 3, 'paged' => $paged );
$loop = new WP_Query( $args );
129 posts
  • Elite Author: Sold more than $75,000 on Envato Market
  • Has sold $250,000+ on Envato Market
  • Located in Ireland
  • Made it to the Authors' Hall of Fame
+5 more
OllieMcCarthy says

don’t forget to add $paged definition ;)
$paged = (get_query_var('paged')) ? get_query_var('paged') : 1;  
$args = array( 'post_type' => 'portfolio_posts', 'portfolio_cats' => $taxonomy_single, 'posts_per_page' => 3, 'paged' => $paged );
$loop = new WP_Query( $args );

Hi PrimaThemes, thanks for taking the time out to reply. Unfortunately it didn’t work. I dunno where I’m going wrong here.

147 posts
  • Has been part of the Envato Community for over 4 years
  • Has referred 10+ members
  • Has sold $250,000+ on Envato Market
  • Has collected 10+ items on Envato Market
+2 more
FlexiPress says

try this one,

First, change your permalink structure to the default permalink… Don’t use nice permalink for the first test… ;)

Second, use query_posts function ;)

$paged = (get_query_var('paged')) ? get_query_var('paged') : 1;  
$args = array( 'post_type' => 'portfolio_posts', 'portfolio_cats' => $taxonomy_single, 'posts_per_page' => 3, 'paged' => $paged );
query_posts( $args );
if ( have_posts() ) :
while ( have_posts() ) : the_post();
... your loop content here ...
endwhile;
... your pagination code here ...
endif;
// Reset Query
wp_reset_query();

let me know if this code doesn’t work for you ;)

129 posts
  • Elite Author: Sold more than $75,000 on Envato Market
  • Has sold $250,000+ on Envato Market
  • Located in Ireland
  • Made it to the Authors' Hall of Fame
+5 more
OllieMcCarthy says

try this one,

First, change your permalink structure to the default permalink… Don’t use nice permalink for the first test… ;)

Second, use query_posts function ;)

$paged = (get_query_var('paged')) ? get_query_var('paged') : 1;  
$args = array( 'post_type' => 'portfolio_posts', 'portfolio_cats' => $taxonomy_single, 'posts_per_page' => 3, 'paged' => $paged );
query_posts( $args );
if ( have_posts() ) :
while ( have_posts() ) : the_post();
... your loop content here ...
endwhile;
... your pagination code here ...
endif;
// Reset Query
wp_reset_query();
let me know if this code doesn’t work for you ;)

Sorry man, it’s still giving me a 404 :(

147 posts
  • Has been part of the Envato Community for over 4 years
  • Has referred 10+ members
  • Has sold $250,000+ on Envato Market
  • Has collected 10+ items on Envato Market
+2 more
FlexiPress says

if you can give me access to your dev site through our profile page, i would love to help you… ;)

129 posts
  • Elite Author: Sold more than $75,000 on Envato Market
  • Has sold $250,000+ on Envato Market
  • Located in Ireland
  • Made it to the Authors' Hall of Fame
+5 more
OllieMcCarthy says

if you can give me access to your dev site through our profile page, i would love to help you… ;)

Awesome! It goes without saying that I will pay for your time. I’ll migrate the localhost installation online in about an hour.

Thanks :)

204 posts Bold WordPress Theme Development
  • Has been part of the Envato Community for over 6 years
  • Has referred 200+ members
  • Has sold $250,000+ on Envato Market
  • Interviewed on an Envato blog
+6 more
srhnbr says

I had the same problem once and I wrote about it here in the forums: http://themeforest.net/forums/thread/custom-post-types-pagination-and-404-not-found-pages/32264

Could it be that you have the same problem?

by
by
by
by
by
by