[wp-trac] [WordPress Trac] #28156: In date-containing permalink structures, /dddd/dd/comment-page-d/ urls don't work

WordPress Trac noreply at wordpress.org
Thu Jun 26 16:38:46 UTC 2025


#28156: In date-containing permalink structures, /dddd/dd/comment-page-d/ urls
don't work
-------------------------------------------------+-------------------------
 Reporter:  mboynes                              |       Owner:  (none)
     Type:  defect (bug)                         |      Status:  reopened
 Priority:  normal                               |   Milestone:
Component:  Permalinks                           |     Version:  3.9
 Severity:  normal                               |  Resolution:
 Keywords:  needs-patch dev-feedback needs-      |     Focuses:
  unit-tests                                     |
-------------------------------------------------+-------------------------

Comment (by mboynes):

 Hey @callumbw95, the ticket is a bit confusing. I'd make it more clear,
 but I don't actually understand the intended functionality. The URLs that
 don't work aren't single-post comment page urls (as you were looking at),
 they're (I guess?) date archive comment page URLs. An example URL is
 `/2025/06/26/comment-page-2/`.

 The specific 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]
 }}}

 There are other, similar rules, that don't 404 but don't seem to show
 anything comments-related:

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

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

 My best guess is that the real bug here is that these urls are invalid and
 are added inadvertently, probably
 [https://github.com/WordPress/WordPress/blob/066852ca4471b9f41917b490cf1f9c4d99f759a2
 /wp-includes/class-wp-rewrite.php#L990-L992 here]. If that's the case,
 then the fix for this ticket would be to move this block outside of the
 directories loop and only add it once to the single post URL. But, perhaps
 there is a feature of WordPress that I'm not aware of! Even after working
 with it for almost 20 years, it still surprises me from time to time :-).

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/28156#comment:6>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list