WordPress.org

Make WordPress Core

Opened 5 years ago

Last modified 16 months ago

#8905 reopened defect (bug)

Category pagination broken with certain permalink structures

Reported by: rmccue Owned by: ryan
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 (11)

comment:1 Denis-de-Bernardy5 years ago

  • Keywords needs-patch added

comment:2 Denis-de-Bernardy5 years ago

  • Milestone changed from 2.8 to Future Release

punting

comment:3 Denis-de-Bernardy5 years ago

  • Milestone changed from Future Release to 2.9

comment:4 jsherk5 years ago

  • Cc jsherk added

I proposed a possible solution here in #9379

comment:5 emartin245 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 azaozz4 years ago

  • Milestone changed from 2.9 to Future Release

No patch.

comment:7 SergeyBiryukov21 months ago

Related: #21209

Last edited 21 months ago by SergeyBiryukov (previous) (diff)

comment:8 wonderboymusic18 months 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 rmccue18 months ago

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

comment:10 SergeyBiryukov18 months 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 SergeyBiryukov16 months ago

#23111 was marked as a duplicate.

Note: See TracTickets for help on using tickets.