I have spent hours looking for a way to make a custom admin menu visable to admins and a custom user role I made called moderators. The menu only appears for admins and not the moderators. How can I make it display for both user types?
functions.php
add_role( 'moderator', 'Moderator', array(
'read' => true,
'add_users'
));
add_action('admin_menu', 'staff_menu');
function staff_menu() {
add_menu_page('Staff Menu: Options', 'Staff Menu', 'add_users', 'staff', 'staff_page', "favicon.ico", 3);
}
function staff_page(){
echo "Staff Page Test will have options here";
}
You forgot to give the
add_usersa value oftrue. The docs foradd_usershow that you need to pass a value, probably a boolean.Update: Check to see if the admin role still has the
add_userscapability.