[wp-trac] [WordPress Trac] #44393: on blog page pagination not working after 75th pages.

WordPress Trac noreply at wordpress.org
Mon Jun 18 11:42:24 UTC 2018


#44393: on blog page pagination not working after 75th pages.
--------------------------+-----------------------------
 Reporter:  sakarya       |      Owner:  (none)
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  General       |    Version:  4.9.6
 Severity:  critical      |   Keywords:
  Focuses:  template      |
--------------------------+-----------------------------
 I created a new theme and I have a blog with 150 pages. I show all content
 in the home.php file.

 After page 75, the paging code is not working. It is redirected to 404
 page.

 Codes in home.php

 {{{
 $i = 0;
 $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;

 query_posts(array(
   'post_type' => 'post',
   'paged' => $paged,
   'posts_per_page' => 6
 ));
 while (have_posts()) : the_post(); $i++;
 ...
 endwhile;
 echo post_pagination();
 wp_reset_postdata();
 }}}

 post_pagination function

 {{{
 function post_pagination() {
         global $wp_query;
         $big = 99999999;
         $page_format = 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,
                 'type'  => 'array'
         ));
         if( is_array($page_format) ) {
                 $paged = ( get_query_var('paged') == 0 ) ? 1 :
 get_query_var('paged');
                 echo '<nav class="pages-area" aria-label="Sayfalama"><ul
 class="pagination">';
                 foreach ( $page_format as $page ) {
                                 echo "<li>$page</li>";
                 }
            echo '</ul></nav>';
         }
 }
 }}}

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/44393>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list