2

Is there a way to delete a custom field (in the sense of complete removal from WP database) without using a plugin?

1 Answer 1

4

If you have access to phpMyAdmin, these steps should do the trick:

Step 1: Login to your hosting account and launch myPHPadmin from the cPanel, or equivalent, to access the WordPress database engine.

Step 2: Enter a select SQL command to list all the meta keys you want to remove. In this example, I want to find and eventually remove the meta key dcssb_short_url.

SELECT * FROM 'wp_postmeta' where 'meta_key' = 'dcssb_short_url'

Step 3: Once you are satisfied you’ve narrowed down the selection, issue a delete SQL command to remove the rogue data

DELETE * FROM 'wp-postmeta' WHERE 'meta_key' = 'dcssb_short_url'

Step 4: Issue the same select SQL command again, to verify all the offending records have been deleted.

SELECT * FROM 'wp_postmeta' where 'meta_key' = 'dcssb_short_url'

If you get no results returned, it means that you successfully deleted the records.

Source

1
  • DELETE * FROM... is not required, probably DELETE FROM... should suffice. Jul 11, 2019 at 13:43

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.