Does WordPress keep track of a post’s URL history and provide automatic redirects?

Does WP keep track of a posts url history, providing rewrites/redirects for former urls?

Yes it does. If you change a post slug, wordpress 301 redirects the old to the new URL (if your server setup allows it).

Any light on how WP handles this would be appreciated.

Unfortunately, I’ve never seen this feature properly documented in the codex. Hence I cannot tell you which wp core function does this and where in the core it is located.

What I can tell you though is this: The previously used slug(s) are stored in the database in the wp_postmeta table. Check for _wp_old_slug in the meta_key column (the actual slugs being stored in the meta_value column). Hence should you ever want this default behavior not to happen in a particular case, this is where to delete a value.

More often than not this feature is very helpful. It screws up though, when you rename a post and later on create a new post with the same name the other one had had earlier.

Leave a Comment