[wp-trac] [WordPress Trac] #39942: Restored Post may steal slug to published Post
WordPress Trac
noreply at wordpress.org
Wed Feb 22 15:37:12 UTC 2017
#39942: Restored Post may steal slug to published Post
-------------------------------+-----------------------------
Reporter: ziodave | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Posts, Post Types | Version: 4.7.2
Severity: normal | Keywords:
Focuses: |
-------------------------------+-----------------------------
Steps to reproduce:
1. Create a Post 1 with title "Post",
2. Assign the slug 'post' to Post 1,
3. Publish Post 1,
4. Unpublish Post 1 by setting it as 'Draft', then Update,
5. After Update, Trash Post 1,
6. Repeat 1-5 for Post 2,
7. Create a Post 3 with title "Post",
8. Assign the slug 'post' to Post 3,
9. Publish Post 3,
10. Now restore Post 2,
11. Open/Reload the edit screen for Post 3,
12. It'll show 'post-2' as slug,
13. Saving/Updating Post 3 will change the slug from 'post' to 'post-2'.
Probably the following functions participate in the issue:
* `wp_add_trashed_suffix_to_post_name_for_post`, which is checking for
{{{
if ( '__trashed' === substr( $post->post_name, -9 ) ) {
}}}
while Post 2 has `post__trashed-2` as post name
* `wp_unique_post_slug`, which is not checking the uniqueness of the slug
if the post is `draft`.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/39942>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list