If you’re trying to paginate on a custom post type, you’re going to run into some trouble. I’ve been paginating a custom query on the biographies at The Nexus. The way pagination works is it listens only to the top level query, and the built in hooks will redirect a any URL like: example.com/person/ryan-rampersad/page/2/
back to example.com/person/ryan-rampersad/
because it doesn’t know any better. Basically, you’ll have infinite redirects without turning off this type of transparent redirection.
From Justin Tadlock of Hybrid fame.
add_filter( 'redirect_canonical', 'my_disable_redirect_canonical' ); function my_disable_redirect_canonical( $redirect_url ) { if ( is_singular( 'client' ) ) $redirect_url = false; return $redirect_url; }
This with this code, you need to change the is_singular
call to check your custom post type’s name.
Upon further digging, I found a WordPress trac ticket about this from two years ago. Yep. I spent hours fiddling with my navigation, various types of URL rewriting and more, just to find out another piece of the magical system was pushing its magic into my neighborhood without any warrant.