Custom post type archive with pagination?

As you can see in the rewrite analyzer, /projects/page/2/ sets projects=page&page=/2 instead of pagename=projects&paged=2 as we would like. So you just need to add a rewrite rule for this special case (in the register_projects() function, after you register your custom post type, would be a good place):

add_rewrite_rule( 'projects/page/([0-9]+)/?$', 'index.php?pagename=projects&paged=$matches[1]', 'top' );

Remember to flush your rewrite rules, by visiting the Permalinks page or by some other way.

Leave a Comment