Make WordPress Core

Opened 15 years ago

Last modified 3 years ago

#8905 assigned defect (bug)

Category pagination broken with certain permalink structures

Reported by: rmccue's profile rmccue Owned by:
Milestone: Future Release Priority: normal
Severity: normal Version: 2.7
Component: Permalinks Keywords: needs-patch needs-testing
Focuses: Cc:


If one uses a permalink structure with %category% followed by %postname%, accessing pagination can cause a 404, as WordPress attempts to look for a post called "page".

As per

Presumably can occur with other permalink structures too.

Change History (17)

#1 @Denis-de-Bernardy
15 years ago

  • Keywords needs-patch added

#2 @Denis-de-Bernardy
15 years ago

  • Milestone changed from 2.8 to Future Release


#3 @Denis-de-Bernardy
15 years ago

  • Milestone changed from Future Release to 2.9

#4 @jsherk
15 years ago

  • Cc jsherk added

I proposed a possible solution here in #9379

#5 @emartin24
15 years ago

Ran into this issue today - would love to see a fix.

I'm not sure if it is as simple as putting some extra logic in parse_request()? Using Doug Smith's code as inspiration, I added the following right before $this->query_vars = apply_filters('request', $this->query_vars); :

if ($this->query_vars['name'] === 'page' && isset($this->query_vars['page'])) {
	$this->query_vars['paged'] = str_replace('/', '', $this->query_vars['page']);


#6 @azaozz
14 years ago

  • Milestone changed from 2.9 to Future Release

No patch.

#7 @SergeyBiryukov
12 years ago

Related: #21209

Last edited 12 years ago by SergeyBiryukov (previous) (diff)

#8 @wonderboymusic
11 years ago

  • Keywords needs-patch removed
  • Milestone Future Release deleted
  • Resolution set to worksforme
  • Status changed from new to closed

http://wordpress-core/uncategorized/test-post-goes-here-this-is-some-more/2/ totally works for me when using <!--nextpage--> and navigating to page 2

#9 @rmccue
11 years ago

Pretty sure this was fixed when some of the permalink stuff was redone.

#10 @SergeyBiryukov
11 years ago

  • Keywords needs-patch added
  • Milestone set to Future Release
  • Resolution worksforme deleted
  • Status changed from closed to reopened

This ticket is about category pagination, not single post pagination.

As noted in #21209, the issue still can be reproduced with bare category slugs:

  1. Set permalink structure to /%category%/%postname%/.
  2. http://mysite/mycat/page/2 gives a 404 error.

Debug Bar info:

Request: mycat/page/2
Query String: page=%2F2&name=page&category_name=mycat
Matched Rewrite Rule: (.+?)/([^/]+)(/[0-9]+)?/?$
Matched Rewrite Query: category_name=mycat&name=page&page=%2F2

#11 @SergeyBiryukov
11 years ago

#23111 was marked as a duplicate.

#12 @ryan
10 years ago

  • Owner ryan deleted
  • Status changed from reopened to assigned

#13 @loushou
10 years ago

This is already fixed. Unless there is some new issue that is not clear here, then this should probably be closed. @SergeyBiryukov's reproduction steps produce the second page now, not a 404. It's not my place to close this, but I'm pretty sure it can be closed as resolved.

#14 @chriscct7
8 years ago

  • Keywords needs-testing close added

#15 @swissspidy
7 years ago

  • Keywords close removed

When there's a post with the slug page, http://mysite/mycat/page/2 shows that post. If there's none, I get a 404.

#16 @SergeyBiryukov
5 years ago

#46475 was marked as a duplicate.

#17 @zeshanb
3 years ago

Hi there,

Paginate_links function inside page template works fine. I can display a category with pagination using a page template pagetemplate-categoryname.php but not a category-categoryname.php, or even the root category.php template in a theme.

For slug page mentioned above the paginate_links would look like this:

					echo paginate_links( array(
						'format' => 'page/%#%',
						'current' => max( 1, get_query_var('paged') ),
						'total' => $wp_query->max_num_pages,
						'prev_next'    => True,
						'prev_text'    => __("<i class=\"material-icons\">chevron_left</i>"),
						'next_text'    => __("<i class=\"material-icons\">chevron_right</i>"),
						'type' => 'list',

There is a "category pagination fix" plugin being offered for category pagination when this should be part of core features of a content management system:

Thank you for your time.



Last edited 3 years ago by zeshanb (previous) (diff)
Note: See TracTickets for help on using tickets.