What are duplicated usermeta?
User metadata, or usermeta, stores additional information for each user account, such as preferences, roles, and plugin-related settings. Duplicated usermeta entries appear when multiple rows in the wp_usermeta table share the same user_id and meta_key, often caused by plugins writing the same data repeatedly.
How they affect your database?
Duplicated usermeta increase database size unnecessarily and can create inconsistencies in user-related data. They may also slow down queries that fetch user information or increase the time required for backups and migrations.
How to clean them?
1. Using Advanced Database Cleaner plugin
You can safely remove duplicated usermeta using the General Cleanup module in Advanced Database Cleaner plugin.
This approach is safe and automated. You can configure it to:
- Detect and delete all duplicated usermeta entries.
- Schedule automatic cleanups to prevent duplicate buildup in the future.
2. Using a raw SQL query
If you prefer to clean manually, run this SQL command in phpMyAdmin for example:
DELETE um1 FROM wp_usermeta um1
INNER JOIN wp_usermeta um2
WHERE
um1.umeta_id > um2.umeta_id
AND um1.user_id = um2.user_id
AND um1.meta_key = um2.meta_key;
Note:
While you can manually run these SQL commands to clean usermeta, we strongly recommend using the Advanced Database Cleaner plugin.
It uses WordPress’s internal cleaning methods, and ensures that all related data is safely removed while keeping your database consistent and stable.