The wp_postmeta
table (all meta tables in WP work similarly) has the following fields:
id
: the primary key of the metadata itempost_id
: the primary key of the post that this metadata relates tometa_key
: the metadata “key”, or name of the metadatameta_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 *
.