Revision: 42807
Updated Code
at March 10, 2011 22:52 by zreedeecom
Updated Code
/**
* Paste the code into your functions.php
* For more info about the options available visit: http://codex.wordpress.org/Roles_and_Capabilities
*/
/**
* Add new permissions/capabilities to a specific role
*
* @param string $role
* @param string $cap
*/
function add_capability($role,$cap) {
$role_obj = get_role($role); // get the the role object
$role_obj->add_cap($cap); // add $cap capability to this role object
}
//add_capability('subscriber','read_private_pages'); //Example
/**
* Remove existing permissions/capabilities to a specific role
*
* @param string $role
* @param string $cap
*/
function remove_capability($role,$cap) {
$role_obj = get_role($role); // get the the role object
$role_obj->remove_cap($cap); // add $cap capability to this role object
}
//remove_capability('subscriber','read_private_pages'); //Example
Revision: 42806
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at March 10, 2011 22:52 by zreedeecom
Initial Code
/**
* Paste the code into your functions.php
* For more info about the options available visit: http://codex.wordpress.org/Roles_and_Capabilities
*/
/**
* Add new permissions/capabilities to a specific role
*
* @param string $role
* @param string $cap
*/
function add_capability($role,$cap) {
$role_obj = get_role($role); // get the the role object
$role_obj->add_cap($cap); // add $cap capability to this role object
}
//add_capability('subscriber','read_private_pages'); //Example
/**
* Remove existing permissions/capabilities to a specific role
*
* @param string $role
* @param string $cap
*/
function remove_capability($role,$cap) {
$role_obj = get_role($role); // get the the role object
$role_obj->remove_cap($cap); // add $cap capability to this role object
}
//remove_capability('subscriber','read_private_pages'); //Example
Initial URL
http://zreedee.com
Initial Description
Initial Title
Add/remove permissions/capabilities for a specific role in wordpress
Initial Tags
wordpress
Initial Language
PHP