I wanted to be able to give a particular user access to an seo plugin (seo ultimate), but not admin level access. I tried adding this to the functions.php
file:
add_action( 'admin_menu', 'seo_menu' );
function seo_menu() {
global $current_user;
$user_roles = $current_user->roles;
$user_role = array_shift($user_roles);
if($user_role == 'editor'){
add_menu_page( $user_role, $user_role, 10, 'seo', 'seo_options', '/wp-content/plugins/seo-ultimate/plugin/img/icon.png' );
}
}
It was working for me when I switch the if operator from ==
to !=
, but not for the Editor. My guess is the permission/role checker is in the plugin itself. So I tried messing around in seo-ultimate.php
, but wasn’t sure what part of it did the role validation. Can anyone point me in the right direction?