Skip to content

Instantly share code, notes, and snippets.

@mehrshaddarzi
Created June 29, 2026 08:31
Show Gist options
  • Select an option

  • Save mehrshaddarzi/150a47d4611d4ab4d5e398257fea38b5 to your computer and use it in GitHub Desktop.

Select an option

Save mehrshaddarzi/150a47d4611d4ab4d5e398257fea38b5 to your computer and use it in GitHub Desktop.
UserMeta Optimize Query

DELETE FROM wp_usermeta WHERE meta_key = 'admin_color' AND user_id IN ( SELECT user_id FROM wp_usermeta WHERE meta_key = 'wp_capabilities' AND ( meta_value LIKE '%"subscriber"%' OR meta_value LIKE '%"customer"%' ) );

SELECT meta_key, COUNT(*) as count FROM wp2_usermeta GROUP BY meta_key ORDER BY count DESC;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment