[wp-trac] [WordPress Trac] #52422: Create a draft with the same slug as an existing post, the existing post will be 404.
WordPress Trac
noreply at wordpress.org
Tue May 3 21:59:45 UTC 2022
#52422: Create a draft with the same slug as an existing post, the existing post
will be 404.
-------------------------------------------------+-------------------------
Reporter: Toro_Unit | Owner: (none)
Type: defect (bug) | Status: new
Priority: normal | Milestone: 6.1
Component: Posts, Post Types | Version:
Severity: normal | Resolution:
Keywords: has-patch has-unit-tests has- | Focuses:
testing-info commit early |
-------------------------------------------------+-------------------------
Comment (by ironprogrammer):
Thanks, @costdev!
== Test Report
[https://core.trac.wordpress.org/attachment/ticket/52422/52422.refresh-of-
PR-1333.diff Patch 52422 (PR 1333 refresh via @costdev)] 👍🏻
=== Env
* WordPress 6.1-alpha-53344-src
* Safari 15.4
* Chrome 101.0.4951.54
* macOS 12.3.1 (Monterey)
* Theme: Twenty Twenty-Two
* Gutenberg DISABLED 🔴
=== Steps to Test
1. Ensure permalink structure is set to "Post name" in ''Settings >
Permalinks''.
1. Under ''Posts > Add New'' create a new post with the title "Test Post"
and **Publish**.
1. In another tab, verify that the post is published at `<your site url
>/test-post/`. ✅
1. Navigate to ''Posts > Add New'' and create another new post with the
title "Test Post 2", and click **Save draft** (DO NOT click **Publish**).
1. Find the "Permalink" metabox on the right-hand side of the post editor
and update the "URL Slug" to `test-post` by removing the `-2` -- this will
match the slug of the first new post. Click **Save draft** again (DO NOT
click **Publish**).
1. In the second tab, refresh the page at `<your site url>/test-post/`.
1. Observe that the post title displayed is now "Test Post 2", indicating
that the draft post is overriding the original post's slug. ❌
1. Open the page in Private Browsing/Incognito mode and observe that a 404
error (not found) is returned, as the draft post is not published. ❌
1. Apply patch. 🛠
1. From the main Posts page, "Move to Trash" and "Delete Permanently" both
"Test Post" and "Test Post 2".
1. Repeat Steps 2 through 5.
1. Observe that the "Permalink" metabox in the post editor refreshes the
"VIEW POST" link to `<your site url>/test-post-2/`. ✅
1. In the second tab, refresh the page at `<your site url>/test-post/`.
1. Observe that the post title remains "Test Post", indicating the draft
has not overridden the published post's slug. ✅
1. In Private Browsing/Incognito, observe that the originally published
post is displayed (404 error has been mitigated).
=== Expected Results (✅)
- The patch corrects the identified issue.
=== Additional Notes
- The above reproduction steps do not apply to Pages, but only to Posts.
Pages seem unaffected by this issue (i.e. a draft page does not override
an existing published page slug).
--
Ticket URL: <https://core.trac.wordpress.org/ticket/52422#comment:17>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list