[wp-trac] [WordPress Trac] #40588: Trashing and restoring a draft post replaces the slug
WordPress Trac
noreply at wordpress.org
Fri Apr 28 11:59:43 UTC 2017
#40588: Trashing and restoring a draft post replaces the slug
------------------------------------------+------------------------------
Reporter: TJNowell | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Posts, Post Types | Version: 4.5
Severity: normal | Resolution:
Keywords: needs-patch needs-unit-tests | Focuses:
------------------------------------------+------------------------------
Comment (by subrataemfluence):
I could reproduce the issue in 4.7.4. I created two posts entitled "40588
Test" and "40588 Test 2" and saved them both as Draft. After trashing and
restoring the permalinks changed to `"__trashed"` and `"__trashed-2"`
respectively. Means this holds true for 4.7.4 as well and not specific to
version 4.5.
However, there is always a chance of WordPress replacing slugs of trashed
posts after restoration because it has to check whether the same permalink
(which the restored post originally had) is already present with other
posts. For a huge database it would be resource consuming to search the
entire `WP_Posts` table and then come up with a relevant permalink based
on its title. It is always a better option for the admin to edit the
permalink once it is restored.
Nevertheless, the permalink could be replaced in a better fashion after
restoration like `post_id-restored` (e.g. 786-restored) if suggesting one
is not the best option.
When trashed WordPress is actually replacing the permalink to `__trashed-
xx`, so it would not be very unlikely that when it is restored WordPress
does the same thing for one more time to make it like I mentioned.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/40588#comment:3>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list