Skip to content

Instantly share code, notes, and snippets.

@pedrorvidal
Created May 12, 2020 22:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pedrorvidal/0c3bf757acd1a6ac5f75fb95acad7ee2 to your computer and use it in GitHub Desktop.
Save pedrorvidal/0c3bf757acd1a6ac5f75fb95acad7ee2 to your computer and use it in GitHub Desktop.
roles
function add_theme_caps() {
// gets the author role
$role = get_role( 'testarole' );
// create if neccesary
if (!$role) $role = add_role('testarole', 'Testa Role');
// add theme specific roles
$role->add_cap('delete_posts');
$role->add_cap('delete_published_posts');
$role->add_cap('edit_posts');
$role->add_cap('edit_published_posts');
$role->add_cap('publish_posts');
$role->add_cap('read');
$role->add_cap('upload_files');
}
add_action( 'admin_init', 'add_theme_caps');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment