WordPress Remove Submenus

Replace all occurrences of $current_user->user_login == ‘username’ with in_array(‘editor’, $current_user->roles). And you can remove the call to get_currentuserinfo(); as for the user information is available from the global variable $current_user. Here’s a code swap: add_action(‘_admin_menu’, ‘remove_editor_submenu’, 1); function remove_editor_submenu() { global $current_user; if(in_array(‘editor’, $current_user->roles)) { remove_action(‘admin_menu’, ‘_add_themes_utility_last’, 101); } } add_action(‘admin_init’, ‘remove_theme_submenus’); function remove_theme_submenus() { … Read more

re-register custom post type with custom capabilities

Have you tried something like this: ‘description’ => __( ‘This is where you can add new Connectors’ ), ‘public’ => true, ‘show_ui’ => true, ‘capability_type’ => ‘page’, ‘publicly_queryable’ => true, ‘exclude_from_search’ => false, ‘hierarchical’ => true, ‘capabilities’ => array( ‘publish_posts’ => ‘update_core’, ‘edit_others_posts’ => ‘update_core’, ‘delete_posts’ => ‘update_core’, ‘delete_others_posts’ => ‘update_core’, ‘read_private_posts’ => ‘update_core’, ‘edit_post’ … Read more