I've got a page of which I'm displaying a load of custom post type posts, much like blog displays a load of posts.

I'm using WP_Query and have my pagination links outputting correctly, however when I navigate to the page 2 url (/my_page/page/2) I get a 404, not surprising because I think WordPress thinks I want sub pages... but I don't, I want that value as the paged value.

Is there a way to enable this on a specific page?

  • Already tried get_query_var( 'paged' );? If not: search for that (via google) on the site. – kaiser Oct 5 '12 at 11:58
  • That would work on the designated blog page, but this is just a standard page. WordPress must think I want sub pages page and 2... I don't. – Ben Everard Oct 5 '12 at 12:03
  • Ah, ok. You ain't got IDs like this in custom permalinks (unless you haven't set them up to append the ID). Your ID is replaced by your page slug for e.g. /my_page. If you then add /page it does a lookup (depending on your rewrite rules) for page/paged query var with the value 2. You need to add much more info to that question. – kaiser Oct 5 '12 at 12:10

in that Archive page, where you have your pagination (did you create it?) use add_query_arg('paged', (int)get_query_var( 'paged' )+1); for the 'next page' href.

Also, WP Page-Navi is a GREAT and easy way to add pagination to your archive-post_type.php file

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.