[wp-hackers] List all capabilities

Dougal Campbell dougal at gunters.org
Thu Jan 20 19:00:46 UTC 2011

On Jan 20 2011 1:18 PM, Ryan Bilesky wrote:
> Now is there a better method, or should I just
> global $wpdb;
> $roles = get_option($wpdb->prefix . 'user_roles');
> and then loop though each role and get it's capability array than merge.

Use the $wp_roles object, which is already defined for you:

     global $wp_roles;
     $roles = $wp_roles->roles;

This will return the same array of role and capability information you 
mentioned before.

Dougal Campbell <dougal at gunters.org>

More information about the wp-hackers mailing list