Tanner,
There are a couple of options.
1. Remove the items manually on each page load via the filters cd_customized_menu
and cd_customized_submenu
. The menu and submenu are always passed through these filters right after being modified but just before being loaded. You could remove the items here. Please note, doing so would not remove them from the saved customizations. So they would not show as removed when actually editing the menus in the Customize Admin tool.
2. Manually save the menu/submenu with the items removed. You can actually use the function cd_update_role_customizations()
to update customizations. Pass the role to update for as the first argument and an array of customizations as the second argument. The array can accept 3 different keys, menu
, submenu
, and dashboard
. You don’t have to pass all 3. Each sub-array would be an array of the menu, submenu, or dashboard widgets.
The menu would look like this:
array(
array(
'id' => 'index.php',
'title' => 'Dashboard',
'original_title' => 'Dashboard',
'icon' => 'admin-dashboard',
'original_icon' => 'admin-dashboard',
'type' => 'menu-item',
'deleted' => false,
'new' => false,
),
);
The submenu would look like this (note how the submenu exists in an array where the key is the parent menu item ID):
array(
'index.php' => array(
'id' => 'update-core.php',
'title' => 'Updates',
'original_title' => 'Updates',
'type' => 'menu-item',
'deleted' => false,
'new' => false,
),
);
Of course, this second option is a bit more intensive and requires you to build out the menu and submenu by hand (through whatever method you come up with).
3. Combination of the above 2 points (kind of). Perhaps this would be your best bet. Use point number 1 to filter out unwanted items on every load, but then also filter the customizations each time it tries to save. There is a filter called cd_db_update_role_customizations
which contains customizations before it saves to the database. The first parameter is the customizations (in the same format as outlined in point 2) and the second parameter is the role. You could always remove your unwanted items here too, so it gets saved that way to the database when you customize.
Anyways, these are just some ideas. There are many filters you can tap into in the plugin. I don’t have a running list anywhere, but if you open up the plugin in an IDE or something, you can search the directory for apply_filters
or do_action
to find them all.
To answer your second question about bulk disable menu items for multiple users, no this does not exist as of now. We definitely want to add more bulk tools in the future, as we understand it can get tedious managing many different role menus. But right now, this is the only way.
Hopefully this gets you going in the proper direction! Let me know if you have any follow up questions. Thank you.