id,summary,reporter,owner,description,type,status,priority,milestone,component,version,severity,resolution,keywords,cc,focuses 32409,paginate_links() shows 404 on custom post type archive,Kuzmanov,,"This is happening only on custom post type archive pages. The scenario is this: * If I remove the `posts_per_page` argument from `WP_Query` it reads the value from `Settings > Reading` and works fine. * If the value of `posts_per_page` in `WP_Query` is bigger or equal than the value in `Settings > Reading` it works fine. * '''The problem:''' If the value of `posts_per_page` in `WP_Query` is smaller than the value in `Settings > Reading` it shows page not found on every `/page/x`. || ||= Settings =||= WP_Query =|| ||= OK =|| 5 || / || ||= OK =|| 5 || 5 or 5+ || ||= NOT OK =|| 5 || 4 or smaller || Here is my query: {{{ $paged = ( get_query_var( 'paged' ) ) ? get_query_var( 'paged' ) : 1; $wp_query = new WP_Query( array( 'post_type' => 'custom_post_type_name', 'post_status' => 'publish', 'paged' => $paged, 'posts_per_page' => 5, ) ); }}} And here is the pagination: {{{ global $wp_query; $total = $wp_query->max_num_pages; if ( $total > 1 ) { // get the current page if ( !$current_page = get_query_var('paged') ) { $current_page = 1; } echo paginate_links(array( 'current' => $current_page, 'format' => '/page/%#%', 'total' => $total, 'mid_size' => 4, 'type' => 'list', 'next_text' => 'next posts', 'prev_text' => 'prev posts' )); } }}}",defect (bug),closed,normal,,Query,4.3,normal,invalid,,,