I have a couple of posts that are getting hammered by bots so I want to change the permalink slugs. However, when I do so WP redirects from the old to the new slug. I want the old slug to give a 404. I've managed to find a partial answer in another thread:

"delete the _wp_old_slug post meta entry from the database for that post"

... but I'm having trouble finding _wp_old_slug in phpMyAdmin - I admit I'm no expert with this, so detailed instructions would be very welcome.


UPDATE: I have now discovered the 'Remove Old Slugs' plugin which resolves my problem, but I would still like to know where to look in phpMyAdmin, for my own knowledge.

  • If it is stored in the post meta, then you can find it under the wp_postmeta table ( assuming your table prefix is wp_ ). You can use the search feature of PhpMyAdmin. Here's a similar question to yours.
    – Johansson
    Commented May 21, 2018 at 15:10

1 Answer 1


The wp_postmeta table (all meta tables in WP work similarly) has the following fields:

  • id: the primary key of the metadata item
  • post_id: the primary key of the post that this metadata relates to
  • meta_key: the metadata "key", or name of the metadata
  • meta_value: the actual metadata value itself

To find old slug entries for a given post (let's assume an id of 123), you would want a query like the following:

FROM   wp_postmeta
WHERE  meta_key = '_wp_old_slug' AND
       post_id = 123;

To delete, just substitute DELETE for SELECT *.

  • Having this kind of generic schema for the table makes it really flexible, but does make it a bit harder to find what you're looking for IME.
    – foresmac
    Commented May 21, 2018 at 15:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.