WordPress.org

Make WordPress Core

Opened 18 months ago

Last modified 18 months ago

#23229 new defect (bug)

Pagination Links Broken

Reported by: ssmathias Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version:
Component: Permalinks Keywords: has-patch
Focuses: Cc:

Description

Currently, if the request URL ends with "page/[\d]+/?" it will always assume that it is the pretty version of the paged parameter, and rewrite that section of the URL.

This breaks in any condition where a numeric value follows that string at the end of a URL. An example that can be easily reproduced is as follows:

1) Set theme to TwentyEleven

2) Modify the theme to output the results of get_pagenum_link(2) anywhere.

3) Change permalink structure to "/daily-page/%year%/%monthnum%/%post_id%/"

4) Go to a year archive for the permalink structure above.

5) The result of the get_pagenum_link will look like this: "/daily-/page/2/", breaking pagination within this context.

I've attached a patch against current trunk code that addresses this, providing the following features:

1) Pagination links functional in the scenario above, along with custom rewrite rules.

2) Updated to allow numeric post names for hierarchical post types (currently always rewritten with "-2")

3) Updated get_pagenum_link filter to include pagenum parameter as it was passed in.

Attachments (1)

23229-r23303.diff (4.5 KB) - added by ssmathias 18 months ago.
Patch against revision 23303 in trunk

Download all attachments as: .zip

Change History (2)

ssmathias18 months ago

Patch against revision 23303 in trunk

comment:1 SergeyBiryukov18 months ago

2) Updated to allow numeric post names for hierarchical post types (currently always rewritten with "-2"

Related: #5305

Note: See TracTickets for help on using tickets.