When you make a change to a post slug permalink after its been published, WordPress will automatically redirect it to the new post slug (doing a 301 redirect). This works well, but sometimes you want no existence of the old post slug. These SQL statements will help you cleanup your old post slugs.
SELECT * FROM `wp_postmeta` WHERE `meta_key` = '_wp_old_slug'
WordPress Old Post Slug Cleanup
To remove the old slug, run the following SQL:
DELETE FROM `wp_postmeta` WHERE `meta_key` = '_wp_old_slug' AND `meta_value` = 'the-old-post-slug'
To remove all old post slugs, run the following SQL:
DELETE FROM `wp_postmeta` WHERE `meta_key` = '_wp_old_slug'
3 responses to “Old Post Slug — WordPress Removal and Cleanup”
The problem is that if Google already indexed the page and you change the permalink the page is “Not Found”. So when ever I change the permalink, I try to make an effort to remember to manually 301 redirect the old page to the new page.
You can also check for page errors in Webmaster Tools by going to Crawl – Crawl Errors – Not Found (look for tab on right)
That was exactly what I was looking for. Thank You !
Agreed, best solution prior to removing old slugs, is to 301 redirect the links that you care about.