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:
Thank you for visiting the Q&A section on Magenaut. Please note that all the answers may not help you solve the issue immediately. So please treat them as advisements. If you found the post helpful (or not), leave a comment & I’ll get back to you as soon as possible.
Method 1
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';
Method 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…
All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0