Make WordPress Core

Opened 11 years ago

Last modified 6 years ago

#28156 new defect (bug)

In date-containing permalink structures, /dddd/dd/comment-page-d/ urls don't work

Reported by: mboynes's profile mboynes Owned by:
Milestone: Priority: normal
Severity: normal Version: 3.9
Component: Permalinks Keywords: needs-patch dev-feedback needs-unit-tests
Focuses: Cc:

Description

I was in the process of writing a plugin to allow people to test their rewrite rules as they develop a site, and when I setup examples of core rewrite rules, one of them was failing.

If you set your permalink structure to one containing dates, e.g. "Day and Name", one of the generated rewrite rules for posts is:

'([0-9]{4})/([0-9]{1,2})/([0-9]{1,2})/([^/]+)(/[0-9]+)?/?$' => 'index.php?year=$matches[1]&monthnum=$matches[2]&day=$matches[3]&name=$matches[4]&page=$matches[5]'

And later on, another rule is:

'([0-9]{4})/([0-9]{1,2})/([0-9]{1,2})/comment-page-([0-9]{1,})/?$' => 'index.php?year=$matches[1]&monthnum=$matches[2]&day=$matches[3]&cpage=$matches[4]'

The URI /2014/5/6/comment-page-2/ would end up matching the earlier rule, looking for a post named "comment-page-2" published on 2014-05-06, instead of looking for comment page 2 in the... I actually don't even know what the comment-page URLs do. For me, the ones that work just redirect to the date archive.

I'm happy to patch this, but would like to hear from someone else on what exactly should be done done. Do the comment-page-n rules do anything? Can they just be removed?

Change History (2)

#1 @Milmor
10 years ago

  • Keywords needs-patch dev-feedback needs-testing added

Can confirm that.

  • Post url: /2015/02/04/comment-page-2/
  • Comments paging active (3-per-page, 7 comments made)

The post url doesn't give me 404, but there are definetely some problems.

Eg.

  • instead of taking me to /2015/02/04/comment-page-2/comment-page-1 i go to 2015/02/04/comment-page-1 (404)
  • instead of taking me to /2015/02/04/comment-page-2/comment-page-3 i go to /nightly/2015/02/04/comment-page-3 (404)

#2 @valendesigns
10 years ago

  • Keywords needs-unit-tests added; needs-testing removed

I wasn't aware that you could view comments outside of their posts in an date based archive format.

Note: See TracTickets for help on using tickets.