Reputation: 31
I've finally exhausted my patience trawling google trying to find a solution to this... any help VERY MUCH appreciated.
I've got a site set up on WP 3.3.2 and I'm using wp_query to query a custom post type:
$paged = (get_query_var('page')) ? get_query_var('page') : 1;
$args = array(
'post_type' => 'feedback',
'meta_key' => 'Overall how would you grade this course?',
'orderby' => $orderby,
'order' => $order,
'posts_per_page' => '10',
'paged' => $paged
);
$feedback = new WP_Query($args);
I've got some additional meta queries in there as well but that's the crux of it.
My problem is pagination... my url comes out as domain.com/client-feedback/page/2/ but I get a 404.
So far I've tried getting the $paged variable as shown above, and also extracting the page number from the URL. I'm fairly confident I've got this nailed. If I force 'paged' => 2
I get the second page of results no problem.
I've also tried running the query as shown, but also hijacking $wp_query (dumping the original into a $temp variable and restoring it after I'm done.)
No matter what I try I can't get beyond page 1. I've been using the pagenavi plugin for ease but disabling it makes no difference.
My best guess is it's permalink related - I've tried /%category%/%postname/ and just /%postname%/ but that makes no difference either.
I'm at a dead end with this one - any thoughts / insight / condolences greatly appreciated.
David.
Upvotes: 1
Views: 1080
Reputation: 11
I gave an plural slug to my custom post type and added this function bellow to solve the problem.
add_filter( 'redirect_canonical', 'department_listing_disable_redirect_canonical' );
function department_listing_disable_redirect_canonical( $redirect_url )
{
if ( is_singular( 'your_custom_post_type_SLUG' ) )
$redirect_url = false;
return $redirect_url;
}
Hope it helps =D
Upvotes: 1