Where is the old post permalink slug stored?

I published an article with permalink slug:

http://domain.com/writing

Then after publishing, I changed the permalink slug to writing-lorem. Now, whenever I visit /writing, it redirects to /writing-lorem.

I want to use the writing slug for a new category but can't, it changes to writing-2.

To attempt to remove all records of the writing slug, I looked in the DB for the post_name column under that post, but the value was the new slug writing-lorem.

Then I search for other posts with the writing value, none found.

Where exactly is that slug stored and how can I remove it so that I can use it for the category?

Answers 2

  • We determined that the slug was not stored in postmeta meta_key _wp_old_slug.

    In a final attempt to find where this slug is stored. I performed a search for the exact phrase of writing and found a few results. The one of interest was in wp_terms.

    I deleted that entry and then changed the slug of the category to /writing and it is working. The strange part was that there were no records within wp_terms that connected the post to the slug.

    Maybe someone is knowledgeable about this table...


  • It's in the table postmeta with the meta_key of _wp_old_slug

    If you wanted to clear all of the old slugs you could use this:

    DELETE FROM wp_postmeta WHERE meta_key = '_wp_old_slug';


Related Questions