Skip to content

Instantly share code, notes, and snippets.

@wpsmith
Created February 15, 2014 18:00
Show Gist options
  • Save wpsmith/9022838 to your computer and use it in GitHub Desktop.
Save wpsmith/9022838 to your computer and use it in GitHub Desktop.
SQL: Get all administrators
SELECT u.ID, u.user_login, u.user_nicename, u.user_email FROM wp_users u INNER JOIN wp_usermeta m ON m.user_id = u.ID WHERE m.meta_key = 'wp_capabilities' AND m.meta_value LIKE '%admin%' ORDER BY u.user_registered
SELECT u.ID, u.user_login, u.user_nicename, u.user_email FROM myprefix_users u INNER JOIN myprefix_usermeta m ON m.user_id = u.ID WHERE m.meta_key = 'myprefix_capabilities' AND m.meta_value LIKE '%admin%' ORDER BY u.user_registered
@wpsmith
Copy link
Author

wpsmith commented Feb 15, 2014

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