[wp-trac] [WordPress Trac] #48658: Generating a new post permalink silently overwrites existing attachment permalink

WordPress Trac noreply at wordpress.org
Fri Nov 15 21:28:17 UTC 2019


#48658: Generating a new post permalink silently overwrites existing attachment
permalink
--------------------------+-----------------------------
 Reporter:  raamdev       |      Owner:  (none)
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  Permalinks    |    Version:  trunk
 Severity:  normal        |   Keywords:
  Focuses:                |
--------------------------+-----------------------------
 When a new post is created with a permalink that matches an existing
 attachment page permalink, the attachment page permalink is silently
 overwritten. The expected behavior of having `-2` appended to the new post
 permalink does not occur and instead the existing attachment page becomes
 inaccessible via its permalink, which starts pointing to the new post
 instead.

 Steps to reproduce:

 1. Ensure pretty permalinks are enabled in Settings -> Permalinks (e.g.,
 `/%postname%/`)
 1. Upload something to the Media Library (e.g., `happy-pumpkin.jpg`)
 1. Note the Attachment Page permalink generated from the upload (e.g.,
 `/happy-pumpkin/`)
 1. Publish a new post with a title that will produce the same permalink
 (e.g., a post title of "Happy Pumpkin" will generate a new post permalink
 of `/happy-pumpkin/`, ''not'' `/happy-pumpkin-2/` as expected)
 1. Now both the attachment page and the new post have the same permalink
 (`/happy-pumpkin/`, in this example) and the attachment page permalink has
 been silently overwritten.

 When the attachment page permalink is overwritten, there's no way to
 access that attachment page on the front-end (it now points at the new
 post). There's also no obvious way to manually change the permalink.

 In testing, what works is to edit some detail of the attachment in the
 Media Library—once the change is saved, the permalink is regenerated and
 updated to include `-2`, which then makes the attachment page accessible
 again.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/48658>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list