Skip to content

Latest commit

 

History

History
37 lines (27 loc) · 1.47 KB

remove-menu-items.md

File metadata and controls

37 lines (27 loc) · 1.47 KB

remove-menu-items

Description

Remove WordPress menu items for specific user roles.

Usage

✓ Supports multiple instances.

intervention('remove-menu-items', $items(string|array), $roles(string|array));

Defaults

$items: danger-zone $roles: all-not-admin

Options

$items: all, danger-zone, dashboard, updates, posts, post-new, post-categories, post-tags, media, media-new, pages, page-new, comments, themes, theme-widgets, theme-menu, theme-editor, plugins, plugin-new, plugin-editor, users, user-new, user-profile, tools, tool-import, tool-export, settings, setting-writing, setting-reading, setting-media, setting-permalink, setting-discussion, setting-media, setting-disable-comments, acf, acf-new, acf-tools, acf-updates

$roles: all, all-not-admin, admin, editor, author, contributor, subscriber

Examples

intervention('remove-menu-items');
// Removes menu item in the danger zone for all-not-admin user roles.

intervention('remove-menu-items', 'plugins');
// Removes menu item plugin for user roles all-not-admin.

intervention('remove-menu-items', ['themes', 'plugins']);
// Removes menu items themes and plugins for user roles all-not-admin.

intervention('remove-menu-items', ['themes', 'plugins'], 'editor');
// Removes menu items themes and plugins for user role editor.

intervention('remove-menu-items', ['updates', 'themes', 'plugins'], ['editor', 'author']);
// Removes menu items themes and plugins for user roles editor and author.