WordPress not remembering old slugs for pages

WordPress keeps track of post slug change with wp_check_for_changed_slugs() function. The old slugs are saved in wp_postmeta table with _wp_old_slug meta_key and later redirects to current URL with wp_old_slug_redirect() function.

That’s why even after changing a post’s slug, you get redirected to the correct post.

However, WordPress doesn’t do this by default with pages (or any hierarchical posts).

It’s still possible to change this behaviour by hooking into post_updated action and replicate wp_check_for_changed_slugs() function for pages (or any hierarchical posts) and then implementing the redirect logic using old_slug_redirect_url hook.

However, this is not recommended.

The main reason is: pages may have multiple levels (hierarchical). For example, a child page can be page_a/child-1 and another child page page_a/child-2 (there can be many more, with multiple levels).

Now, changing page_a slug affects both child-1 and child-2 pages. So to implement this properly, while visiting both child-1 and child-2, WordPress will have to check for first child-1 or child-2 slug change, and then page_a parent slug change. This sort of multi level checks will slow down WordPress for hierarchical posts or pages.

You’ll find a similar discussion in WordPress.org support.

If you still need this, it’s better to use a redirect plugin and manually add the redirect for pages with old permalinks.