When a WordPress post changes its slug, the old address does not simply die. WordPress records the previous slug in post meta and answers requests for it with a redirect to the new location. That behaviour keeps inbound links working, but it also means a URL and the post behind it can drift apart. This article walks through what the redirect does, where it breaks, and how an external tool should treat it.
Where the old slug is kept
The moment a published post is saved with a new post name, WordPress writes the previous value into the old slug meta key. The template loader consults that key when a request matches no post, and if it finds one it issues a permanent redirect to the post’s current permalink. Nothing is stored about when the change happened or who made it, so the meta is a hint, not a history.
What the redirect hides
A browser following the redirect sees the right page, so from the outside nothing looks wrong. The trouble starts when a program resolves the address by slug instead of by following the response. A lookup for the old slug returns nothing, because the slug is now on nobody. A tool that then falls back to creating content would produce a second copy of a page that already exists under a different address.
Signals worth checking
Three checks separate a moved post from a missing one. First, fetch the old address without following redirects and read the Location header. Second, look the post up by its numeric id rather than its slug wherever an id is known. Third, compare the canonical link in the page head with the address that was requested. If any of those disagree, the page has moved and the safe action is to stop rather than to guess.
What editors can do
Editors rarely rename a slug for fun. A rename usually follows a title change, a merge of two articles, or a cleanup of dates that used to sit in the path. Keeping a short note of the old and the new address in the revision comment costs nothing and answers the question weeks later when a report shows traffic arriving at an address nobody remembers.
Summary
The redirect is a courtesy to visitors, not a promise to software. Treat a slug that no longer resolves as a warning that the post has moved, look it up by id when possible, and never create a new post in response to a lookup that came back empty.
Leave a Reply