Opened 6 years ago
Last modified 13 months ago
#4328 new enhancement
Redirect Old Slugs feature needs to redirect slugs for pages, not just posts, and redirect old permalink structure
| Reported by: |
|
Owned by: |
|
|---|---|---|---|
| Priority: | normal | Milestone: | Future Release |
| Component: | Canonical | Version: | 2.2 |
| Severity: | normal | Keywords: | has-patch |
| Cc: | varun21 |
Description
Create a page, browse to it, edit it, change its slug, WP redirects to the old page's slug and serves a 404. Wasn't WP 2.1 or WP 2.2 supposed to make the redirect old slug feature built-in?
Along the same lines, it would be sweet if instead of simply redirect old slugs, WP would redirect old urls. When the date changes, when the page parent changes, or when the permalink structure changes, the url changes but neither of WP, the redirect old slug plugin, the permalink redirect plugin, or anything else catches this.
Attachments (2)
Change History (25)
comment:3
markjaquith — 6 years ago
- Milestone changed from 2.2.2 to 2.4
- Type changed from defect to enhancement
WP 2.1+ has it built in, but it only works with posts (by design). I just tested it on Trunk and 2.2, and it works as expected for posts.
Having it work for pages or having it track more than slug changes would be a new feature, so it doesn't belong in a 2.2.x release.
comment:4
JeremyVisser — 6 years ago
- Summary changed from redirect old slug feature is very broken to Redirect Old Slugs feature needs to redirect slugs for pages, not just posts, and redirect old permalink structure
Any odds we'll see this in an early 2.5.x?
- Component changed from General to Permalinks
- Owner changed from anonymous to ryan
- Component changed from Permalinks to Canonical
- Owner changed from ryan to markjaquith
comment:10
westi — 4 years ago
- Milestone changed from 2.9 to Future Release
As we are now feature frozen it is too late to include this into 2.9.
Moving to Future Release as there is currently no patch.
comment:11
mdawaffe — 3 years ago
4328.diff turns old slug redirect on for pages.
Two line patch seems to work fine... what are the edge cases?
Works with top level pages and child pages.
comment:12
mdawaffe — 3 years ago
comment:ticket:3202:2 by markjaquith says
Only works on posts. There doesn't seem to be a clean way of recognizing failed Page attempts... of course there is always my "Page Links To" plugin to take care of that. ;-)
Quote is 3 years old. Either there are some cases I didn't think of or it's no longer true :)
comment:13
mdawaffe — 3 years ago
- Keywords has-patch added
comment:14
dd32 — 3 years ago
The only side effect to this would be creating a page AND post of the same name, and then renaming one or both of them.. It might not have the intended path to follow through?
comment:15
SergeyBiryukov — 2 years ago
Related: #15953
comment:16
dd32 — 2 years ago
See Also: #15140
comment:18
SergeyBiryukov — 2 years ago
- Keywords needs-refresh removed
SergeyBiryukov — 2 years ago
comment:19
SergeyBiryukov — 2 years ago
According to Denis' comment on #15140:
If both the slug and the parent change, the redirect doesn't work.
However it seems to be working on current trunk (with the refreshed patch).
comment:20
dd32 — 22 months ago
Closed #18318 as a Duplicate
comment:21
varun21 — 22 months ago
When are we expecting this to land into the production distro? Tnx.
comment:22
varun21 — 22 months ago
- Cc varun21 added
Just stumbled upon this once again. I had the impression that _wp_old_slug works for both posts and pages.

adding to the above, the workflow would be:
on post save, cache the url in a custom field. if url is different, append previous value to the old urls.
on permalink structure change, do the above for every post and page on the site.
extra benefit: scanning for which post is requested can be simplified in many cases to something like: select from posts inner join postmeta where url_cache.
D.