Created
August 25, 2010 17:48
-
-
Save v9n/549958 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//RAW SQL | |
SELECT u.ID, u.user_nicename | |
FROM wp_users AS u | |
LEFT JOIN wp_usermeta AS m ON m.user_id=u.ID AND m.meta_key='wp_capabilities' | |
WHERE m.meta_value LIKE '%contributor%' | |
//PHP | |
$sql = " | |
SELECT u.ID, u.user_nicename | |
FROM $wpdb->users AS u | |
LEFT JOIN $wpdb->usermeta AS m ON m.user_id=u.ID AND m.meta_key='wp_capabilities' | |
WHERE m.meta_value LIKE '%contributor%' | |
"; | |
$authors = $wpdb->get_results($sql); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment