Skip to content

Instantly share code, notes, and snippets.

@ammist
Created December 22, 2011 00:57
Show Gist options
  • Save ammist/1508426 to your computer and use it in GitHub Desktop.
Save ammist/1508426 to your computer and use it in GitHub Desktop.
WordPress SQL queries I use a lot
-- Life is better when you can cut and paste
-- Post meta
-------------
-- Site Options
-------------
select distinct option_name from wp_options;
-------------
-- User data
-------------
-- Get the user meta names.
select distinct meta_key from wp_usermeta;
-- Get user capabilities. This will tell you if they are, say,
-- an admin, a subscriber, or have some custom capability assigned.
select distinct meta_key, meta_value from wp_usermeta where meta_key like '%capabilities%';
select distinct meta_key, meta_value from wp_usermeta where meta_key like '%capabilities%' && meta_value like '%espresso%';
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment