Here is the code I’m using to display the pagination…
<?php
global $wp_query;
$big = 999999999; // need an unlikely integer
echo paginate_links( array(
'base' => str_replace( $big, '%#%', esc_url( get_pagenum_link( $big ) ) ),
'format' => '?paged=%#%',
'current' => max( 1, get_query_var('paged') ),
'total' => $wp_query->max_num_pages
) );
?>
But when you click next and got to /page/2/ it says “Page Not Found”
what am I doing wrong???
The code above is not working because it is not set for a custom post type.
If you look in the wordpress codex for paginate_links you will find your code under the
and is not working for your query because you have different query_vars, the code you should work with should be from the same codex page:
and the pagination code:
When working with pagination “Page not found” errors usually are caused by missuning the query vars.