Last active
December 19, 2015 16:19
-
-
Save jgalea/5982726 to your computer and use it in GitHub Desktop.
Adds a capability to an existing role.
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
<?php | |
function add_capability() { | |
// gets the author role | |
$role = get_role( 'author' ); | |
// This only works, because it accesses the class instance. | |
$role->add_cap( 'edit_others_posts' ); | |
} | |
add_action( 'admin_init', 'add_capability'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment