WordPress.org

Make WordPress Core

Opened 18 months ago

Closed 18 months ago

Last modified 14 months ago

#44393 closed defect (bug) (invalid)

on blog page pagination not working after 75th pages.

Reported by: sakarya Owned by:
Milestone: Priority: normal
Severity: critical Version: 4.9.6
Component: General Keywords:
Focuses: template Cc:
PR Number:

Description

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>';
	}
}

Change History (2)

#1 @nunomorgadinho
18 months ago

  • Resolution set to invalid
  • Status changed from new to closed

Most likely not a problem with core but rather your theme. If you can replicate this issue with twentyseventeen and other themes hit us up again.

#2 @netweb
14 months ago

  • Milestone Awaiting Review deleted
Note: See TracTickets for help on using tickets.