0

I have tried the code below to allow Editors to access menu settings. I then removed it from functions.php but the Editor access is still there so looks like this has made a permanent change!

Ayy ideas how I can roll this back (to remove editor access to Appearance).

Thanks

/**
* @var $roleObject WP_Role
*/
$roleObject = get_role( 'editor' );
if (!$roleObject->has_cap( 'edit_theme_options' ) ) {
$roleObject->add_cap( 'edit_theme_options' );
}

1 Answer 1

0

From WordPress Codex:

Changing the capabilities of a role or user is persistent, meaning the added capability will stay in effect until explicitly revoked.

You might want to do something like:

$roleObject = get_role( 'editor' );
if ($roleObject->has_cap( 'edit_theme_options' ) ) {
    $roleObject->remove_cap( 'edit_theme_options' );
}
0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.