Remove Posts menu for Editor, Author, and Contributor

// Remove Posts menu for Editor, Author, and Contributor
if (! current_user_can('manage_options')) {
    add_action('admin_menu', 'notadmin_remove_menus', 999);
    function notadmin_remove_menus() {
      remove_menu_page('edit.php'); // Posts
      remove_menu_page('tools.php'); // Tools
      remove_submenu_page('edit.php?post_type=custom_post_type', 'post-new.php?post_type=custom_post_type'); // Custom Post Type
    }
}

Source: 10+ Useful WordPress Code Snippets

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.