How To Delete Custom Field Data From WordPress Without Plugins
If you’ve ever installed and later removed WordPress plugins, you may have noticed they often leave behind a mess — extra custom field data (also known as meta keys) sitting in the database doing nothing. Over time, all this leftover data can clutter things up and even slow down your site.
In this guide, you’ll learn how to safely delete Custom Field Data from WordPress (Meta Key) and clean up your database — all without using additional plugins.

Whether you’re looking to improve performance or simply want to tidy up your WordPress site, follow along for a step-by-step solution that’s both safe and efficient.
Method 1 — Delete Custom Field Data from WordPress via Code
1. Back up your WordPress database
Before making any changes, always create a full backup of your database. This ensures that if anything goes wrong, you can restore your site easily.
You can use tools like UpdraftPlus, All-in-One WP Migration, or your hosting panel’s backup feature.
2. Decide which Meta Keys (Custom Field Name) to Remove
Make a list of the custom field name you want to delete. These are usually meta keys left behind by old plugins.
Example:
web_stories_blurhash
web_stories_base_color
ss_social_share
data_group_array
footnotes
classic_editor_remember
3. Add the Cleanup code to WordPress
Go to your WordPress admin and add this code using a safe method:
- Use a Code Snippets plugin (recommended)
- Or place it in your theme’s
functions.php
(if you’re comfortable)
If you’re using Code Snippet follow this step:
- Go to Snippets > Add New
- Give it a title “Remove Custom Field Name” or anything you like
- Copy and paste the code given below:
Replace highlighted part with your meta keys (custom field name) you want to remove:
Version 1: To remove specific Meta Keys in Bulk
add_action('admin_init', function() {
if (!current_user_can('administrator')) {
return;
}
global $wpdb;
// List the meta keys you want to remove
$meta_keys_to_remove = [
'your_custom_field_123', // Replace with your meta key
'your_custom_field_abc',
'your_custom_field_xyz',
'your_custom_field_name'
// Add other meta keys here as needed
];
$deleted_summary = [];
// Remove from wp_postmeta
$placeholders = implode(', ', array_fill(0, count($meta_keys_to_remove), '%s'));
$sql = $wpdb->prepare(
"DELETE FROM {$wpdb->postmeta} WHERE meta_key IN ($placeholders)",
...$meta_keys_to_remove
);
$deleted = $wpdb->query($sql);
$deleted_summary[] = "wp_postmeta: " . intval($deleted);
// Remove from wp_termmeta
$sql = $wpdb->prepare(
"DELETE FROM {$wpdb->termmeta} WHERE meta_key IN ($placeholders)",
...$meta_keys_to_remove
);
$deleted = $wpdb->query($sql);
$deleted_summary[] = "wp_termmeta: " . intval($deleted);
// Remove from wp_usermeta
$sql = $wpdb->prepare(
"DELETE FROM {$wpdb->usermeta} WHERE meta_key IN ($placeholders)",
...$meta_keys_to_remove
);
$deleted = $wpdb->query($sql);
$deleted_summary[] = "wp_usermeta: " . intval($deleted);
// Show admin notice
add_action('admin_notices', function() use ($deleted_summary) {
echo '<div class="notice notice-success"><p>Meta cleanup results:</p><ul>';
foreach ($deleted_summary as $line) {
echo '<li>' . esc_html($line) . '</li>';
}
echo '</ul></div>';
});
});
✅ This code will:
- Only run for administrators
- Remove the selected custom fields (meta keys) from
wp_postmeta
,wp_termmeta
,wp_usermeta
- Display a summary notice of how many database rows were deleted
Version 2: To remove all common Prefix Meta Keys
add_action('admin_init', function() {
if (!current_user_can('administrator')) {
return;
}
global $wpdb;
$deleted_summary = [];
// wp_postmeta
$deleted = $wpdb->query(
"DELETE FROM {$wpdb->postmeta} WHERE meta_key LIKE 'your_custom_field_abc_%'"
);
$deleted_summary[] = "wp_postmeta: deleted $deleted rows";
// wp_termmeta
$deleted = $wpdb->query(
"DELETE FROM {$wpdb->termmeta} WHERE meta_key LIKE 'your_custom_field_abc_%'"
);
$deleted_summary[] = "wp_termmeta: deleted $deleted rows";
// wp_usermeta
$deleted = $wpdb->query(
"DELETE FROM {$wpdb->usermeta} WHERE meta_key LIKE 'your_custom_field_abc_%'"
);
$deleted_summary[] = "wp_usermeta: deleted $deleted rows";
// Show notice
add_action('admin_notices', function() use ($deleted_summary) {
echo '<div class="notice notice-success"><p><strong>SASWP cleanup completed:</strong></p><ul>';
foreach ($deleted_summary as $line) {
echo '<li>' . esc_html($line) . '</li>';
}
echo '</ul></div>';
});
});
Note: In Version 2, place same Meta Key name in all three wp_postmeta
, wp_termmeta
, wp_usermeta
✅ This code will:
- Only run for administrators
- Remove the selected custom fields (meta keys) from
wp_postmeta
,wp_termmeta
,wp_usermeta
- Display a summary notice of how many database rows were deleted
- Delete all meta keys with a common prefix using
'prefix_%'
(e.g.,web_stories_%
matches all meta keys starting withweb_stories_
)
4. Check your site
After running the code:
- Verify your site is working as expected.
- If you used a code snippet plugin, disable the snippet after cleanup — no need to leave it active.
5. Clear Cache
If you’re using caching (e.g. LiteSpeed, W3 Total Cache, or browser cache), clear it so your site serves fresh data.
Method 2 — Delete Custom Field Data from WordPress via phpMyAdmin
1. Log in to phpMyAdmin
- Access phpMyAdmin from your hosting control panel (like cPanel, Plesk, or DirectAdmin).
- Select your WordPress database from the sidebar (the one in
wp-config.php
asDB_NAME
)

2. Click on the SQL tab
At the top of the phpMyAdmin interface, click the SQL tab.

3. Run your delete query
In the SQL box, enter a query like:
Query to Delete a specific custom field:
DELETE FROM wp_postmeta WHERE meta_key = 'your_custom_field_name';
Example for 👉 Delete a specific custom field:
DELETE FROM wp_postmeta WHERE meta_key = 'web_stories_blurhash';
Example for 👉 Delete multiple specific fields:
DELETE FROM wp_postmeta WHERE meta_key IN (
'web_stories_blurhash',
'web_stories_base_color'
);
Example for 👉 Delete fields with a common prefix:
DELETE FROM wp_postmeta WHERE meta_key LIKE 'web_stories_%';
4. Click ”Go”
- Click the Go button to execute the query.
- Done — your custom field data is removed.
⚠ Important tips
✅ Double-check the meta_key
before running the query.
✅ You can run a SELECT
first to preview:
SELECT * FROM wp_postmeta WHERE meta_key LIKE 'your_custom_field_name_%';
Why Some Custom Field Names Keep Reappearing in WordPress After Removal
Some meta keys may keep reappearing in your database even after you delete them. This is because they are automatically generated by your active theme, plugins, or even by WordPress core itself as part of its normal operations. For example, meta keys related to footnotes come from WordPress core and are used to manage certain content features. In these cases, simply deleting the meta keys won’t stop them from coming back.
Also Read: How to Add a Subtitle to WordPress Posts Without Plugin
Final Tip
After cleanup, keep an eye on your database now and then to ensure unnecessary meta keys from removed plugins don’t accumulate again.
That’s it! With just a little cleanup, you can keep your WordPress site’s database lean and running smoothly. This simple method to Delete Custom Field Data will help maintain optimal performance.
If you have any questions about how to delete custom field data or manage your database, feel free to drop them in the comments below
Disclaimer: The methods and code provided in this guide are for informational purposes only. Please ensure you create a full backup of your WordPress site and database before making any changes. We are not responsible for any data loss, site malfunction, or other issues that may arise from following this tutorial. If you are unsure or unfamiliar with editing code or databases, consider seeking assistance from a qualified developer or your hosting provider.
FAQs about deleting custom field data in WordPress
What are WordPress meta keys (custom fields)?
Meta keys are pieces of metadata stored in your WordPress database. They hold extra information about your posts, users, or terms — for example, settings created by plugins, theme features, or even WordPress core.
Is it safe to delete unused meta keys from the WordPress database?
Yes — but only if you’re certain they are no longer needed. Removing unused meta keys can help clean up your database. Always back up your site before deleting any data, and double-check that the meta keys aren’t used by your active plugins, theme, or WordPress itself.
Why do deleted meta keys keep coming back in WordPress?
Deleted meta keys may reappear if they’re automatically generated by an active plugin, theme, or WordPress core. For example, custom field like ‘footnotes’ or ‘classic-editor-remember’ may keep reappear during normal operation, and deleting them won’t stop them from being recreated.
How can I bulk delete meta keys without a plugin?
You can bulk delete meta keys using custom code (added via Code Snippets or functions.php) or by running SQL queries in phpMyAdmin. Both methods allow you to safely remove specific meta keys or keys with a matching prefix directly from your database.
Will deleting meta keys improve my WordPress site speed?
In most cases, cleaning up unused meta keys will not drastically speed up your site. However, it can reduce database bloat, improve database queries, and make database maintenance easier — especially on large or older sites with lots of leftover data.