https://preview.redd.it/gt7116ldmw7d1.png?width=201&format=png&auto=webp&s=b484d735ee53c5f91f10500cafb34b3659d4dabc
like the title says, i want my authors to only see the “Posts” and “Media” menu items. i already locked down the tools and site settings so they get an “not authorised” message when they click on them. but i want the options to be gone from their menu. i work with some less then IT savvy authors and the whole process of creating a post needs to be as simple as possible. having menu options that they don’t need will just confuse them.
edit; some items like plugins and pages are already not available, so is there some place i can add all the other items?
[ad_2]
something like this:
function remove_menus_for_authors() {
// Check if the current user is an author
if (current_user_can(‘author’) && !current_user_can(‘administrator’)) {
// Remove unnecessary menu items
remove_menu_page(‘index.php’); // Dashboard
remove_menu_page(‘edit.php?post_type=page’); // Pages
remove_menu_page(‘upload.php’); // Media
remove_menu_page(‘edit-comments.php’); // Comments
remove_menu_page(‘themes.php’); // Appearance
remove_menu_page(‘plugins.php’); // Plugins
remove_menu_page(‘users.php’); // Users
remove_menu_page(‘tools.php’); // Tools
remove_menu_page(‘options-general.php’); // Settings
}
}
add_action(‘admin_menu’, ‘remove_menus_for_authors’);