WordPress.org

Make WordPress Core

Opened 7 years ago

Last modified 11 months ago

#8905 assigned defect (bug)

Category pagination broken with certain permalink structures

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

Description

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 http://barefootdevelopment.blogspot.com/2007/11/fix-for-wordpress-paging-problem.html

Presumably can occur with other permalink structures too.

Change History (13)

comment:1 @Denis-de-Bernardy6 years ago

  • Keywords needs-patch added

comment:2 @Denis-de-Bernardy6 years ago

  • Milestone changed from 2.8 to Future Release

punting

comment:3 @Denis-de-Bernardy6 years ago

  • Milestone changed from Future Release to 2.9

comment:4 @jsherk6 years ago

  • Cc jsherk added

I proposed a possible solution here in #9379

comment:5 @emartin246 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'])) {
	unset($this->query_vars['name']);
	$this->query_vars['paged'] = str_replace('/', '', $this->query_vars['page']);
}

Thoughts?

comment:6 @azaozz6 years ago

  • Milestone changed from 2.9 to Future Release

No patch.

comment:7 @SergeyBiryukov3 years ago

Closed #21209 as a duplicate.

Version 0, edited 3 years ago by SergeyBiryukov (next)

comment:8 @wonderboymusic3 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

comment:9 @rmccue3 years ago

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

comment:10 @SergeyBiryukov3 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

comment:11 @SergeyBiryukov3 years ago

#23111 was marked as a duplicate.

comment:12 @ryan13 months ago

  • Owner ryan deleted
  • Status changed from reopened to assigned

comment:13 @loushou11 months 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.

Note: See TracTickets for help on using tickets.