• Not sure, but I think I found a bug in the old slug feature of WordPress.

    When I edit a slug for posts or custom post types WordPress create a _wp_old_slug field in the wp_postmeta table (containing the old permalink).

    But when I do this for pages this doesn’t happen.

    Am I missing a setting here or is this a bug in WordPress?

Viewing 1 replies (of 1 total)
  • Moderator Samuel Wood (Otto)

    (@otto42)

    www.remarpro.com Admin

    Yes, this is the correct behavior.

    Old slugs are only saved for “non-hierarchical” post types. Pages are hierarchical.

    Hierarchical means that they use parents to build the URL. Like, if you make “page1” and then “child1” as a child of it, then the URL will be /page1/child1.

    Slug changes in this type of case can change the URL of many pages. Imagine changing page1 to pag2 and suddenly all the URLs for the children change as well. So old slugs don’t help with the redirection functionality without doing a much more complex and lengthy tree based search, which WordPress does not implement for speed reasons.

    So old slugs are indeed not saved for pages, or for any post type marked as hierarchical.

Viewing 1 replies (of 1 total)
  • The topic ‘_wp_old_slug not created for pages’ is closed to new replies.