Delete Redirect Slug For Specific Post

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:

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

To delete, just substitute DELETE for SELECT *.