#45357 closed defect (bug) (invalid)
filter wp_unique_post_slug > doesn't pass original_slug
Reported by: | preliot | Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | minor | Version: | 5.0 |
Component: | Posts, Post Types | Keywords: | |
Focuses: | Cc: |
Description
I'm using WordPress 5.0 Beta 4. Also noticed bug in earlier versions, such as 4.9.8.
Steps to recreate:
- Create new page / post
- Save post
- Edit post and change slug
- Filter 'wp_unique_post_slug' passes same value for $slug and $original_slug
Expected outcome:
- $slug = new slug
- $original_slug = old slug
Change History (2)
Note: See
TracTickets for help on using
tickets.
Hi there and welcome to WordPress Trac!
The value of
$original_slug
isn't the old slug of the post, but the original value of the$slug
at the beginning of thewp_unique_post_slug
function, before it was modified.When you edit the post in the editor, you tell WordPress your new slug. To make sure the new value is unique across posts, it's ran through
wp_unique_post_slug
. The old value of the slug is not involved in this process at all.