Advertisement
hostmaria

How to Remove Spam Users from WordPress by Identifying Common Spam Email Domains with phpMyAdmin SQL

Dec 27th, 2024
123
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.67 KB | None | 0 0
  1. Step 1: Backup Your Database
  2.  
  3. #
  4.  
  5. Step 2: Open phpMyAdmin
  6.  
  7. #
  8.  
  9. Step 3: Find Users by most used domains in their emails
  10. SELECT
  11. SUBSTRING_INDEX(user_email, '@', -1) AS domain,
  12. COUNT(*) AS count
  13. FROM
  14. wp_users
  15. WHERE
  16. SUBSTRING_INDEX(user_email, '@', -1) NOT IN ('gmail.com', 'outlook.com', 'hotmail.com')
  17. GROUP BY
  18. domain
  19. ORDER BY
  20. count DESC
  21. LIMIT 100;
  22.  
  23. #
  24.  
  25. Step 4: Check These Users
  26. SELECT * FROM `wp_users` WHERE `user_email` LIKE '%@tyypet.cn';
  27.  
  28. #
  29.  
  30. Step 5: Remove Users
  31. DELETE FROM `wp_users` WHERE `user_email` LIKE '%@tyypet.cn';
  32.  
  33. #
  34.  
  35. Step 6: Cleanup Metadata
  36. DELETE FROM `wp_usermeta` WHERE `user_id` NOT IN (SELECT `ID` FROM `wp_users`);
  37.  
  38.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement