Created
July 1, 2019 14:44
-
-
Save alordiel/653a8b719d9150f4ffa92f6ec70151b9 to your computer and use it in GitHub Desktop.
[WordPress] Add capability for single user or role
This file contains hidden or 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
add_action( 'admin_init', 'add_theme_caps'); | |
function add_theme_caps() { | |
// add single role capability | |
$role = get_role( 'administrator' ); | |
$role->add_cap( 'manage_phrases' ); | |
// add single user capability | |
$user = new WP_User( 4766 ); | |
$user->add_cap( 'manage_phrases' ); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment