archive pagination does not work
-
I created a custom post type and can view individual posts just fine. I can click on the previous and next links to scroll through all the custom post pages.
When I go to the archive page that I created, I can see several posts as expected – and the pagination shows I’m on page 1 and there are other pages available.
If I hover over one of the page links I get a link like
https://www.mysite.com/video/page/2/
clicking on any page links goes to the 404 pageI searched for a long time and most people seem to have the same code.
I have the following at the top of my archive page
$paged = ( get_query_var( 'paged' ) ) ? get_query_var( 'paged' ) : 1; $args = array( 'post_type' => 'video', 'posts_per_page' => 2, 'paged' => $paged, ); $query = new WP_Query( $args );
and lower down I have
echo paginate_links( array( 'base' => str_replace( 999999999, '%#%', esc_url( get_pagenum_link( 999999999 ) ) ), 'total' => $query->max_num_pages, 'current' => max( 1, get_query_var('paged') ), 'format' => '/page/%#%', //was '?paged=%#%' 'show_all' => false, 'type' => 'plain', 'end_size' => 2, 'mid_size' => 1, 'prev_next' => true, 'prev_text' => sprintf( '<i></i> %1$s', __( '? Previous', 'text-domain' ) ), 'next_text' => sprintf( '%1$s <i></i>', __( 'Next ?', 'text-domain' ) ), 'add_args' => false, 'add_fragment' => '', 'before_page_number' => '', 'after_page_number' => '' ) );
Any idea what I’m missing? your help would be appreciated.
Viewing 5 replies - 1 through 5 (of 5 total)
Viewing 5 replies - 1 through 5 (of 5 total)
- The topic ‘archive pagination does not work’ is closed to new replies.