Skip to content

Instantly share code, notes, and snippets.

@jgalea
Created July 12, 2013 10:24
Show Gist options
  • Save jgalea/5983390 to your computer and use it in GitHub Desktop.
Save jgalea/5983390 to your computer and use it in GitHub Desktop.
Check if a user has a capability or role.
<?php
// Checking for capability
if ( user_can( 6, 'read' ) ) {
// Do something
}
// Checking for role
if ( user_can( 6, 'administrator' ) ) {
// Do something
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment