WordPress.org

Make WordPress Core

Opened 3 months ago

Last modified 3 months ago

#47813 new defect (bug)

permalinks broken when article name is numeric(if the post id above 1000)

Reported by: guigmonteiro Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version: 5.2.2
Component: Permalinks Keywords: reporter-feedback
Focuses: Cc:
PR Number:

Description

This is a follow-up to #5305.

The problem on ticket #5305 stil happens if the post have the id above 1000

Steps to reproduce:

Create a post without title(it shout have the id above 1000)
Change the permalink structure to post name (/%postname%/)
Click on the post permalink and try view it

it sends back to the archive page of the post_type instead of the single page of the post

Change History (1)

#1 @SergeyBiryukov
3 months ago

  • Keywords reporter-feedback added

Hi @guigmonteiro, welcome to WordPress Trac! Thanks for the report.

To clarify a bit, #5305 addressed the issue from two points:

  • [32647] Prevent post slugs that could result in URLs that conflict with date archives. (This only applies to permalink structures containing /%postname%/.)
  • [32648] When parsing what appears to be a date archive request, check for a post with a clashing permalink before resolving to the archive.
  • Some follow-up fixes: [33261], [33262], [33630].

Changing the permalink structure after a post with a 4-digit numeric slug is already created seems a bit like an edge case, but [32648] should still account for that.

In my testing, I could not reproduce the issue on a clean install so far. My steps:

  1. Switch the permalink structure to a one without /%postname/, e.g. /archives/%post_id%.
  2. Create a post without title. In my case it got the ID of 1864.
  3. Change the permalink structure to /%postname%/.
  4. View the post, it show up as expected (single.php template, not the archive page).

Debug Bar plugin shows:

Matched Rewrite Query: year=1864
Query String: name=1864

So wp_resolve_numeric_slug_conflicts() seems to work as expected for me, correctly rewriting the date query (year=1864) to a post query (name=1864).

Could you share the ID of the post that doesn't work for you, and the date it was published?

Note: See TracTickets for help on using tickets.