Backend menu

Overview

Manage access to WordPress admin menu items. Select the subject with AAM::api()->backend_menu($access_level, $settings). Omit $access_level to use the current user or visitor.

PHP class: AAM_Framework_Service_BackendMenu.

Method reference

Method Purpose
get_items() List discovered items.
items() Alias of get_items().
get_item($menu_slug) Get one discovered item.
item($menu_slug) Alias of get_item().
deny($menu_slug) Store a deny rule.
allow($menu_slug) Store an allow rule.
reset($menu_slug = null) Remove one rule or all rules for this level.
is_denied($menu_slug) Check the effective deny decision.
is_allowed($menu_slug) Check the effective allow decision.

Return values vary by method. Rule updates usually return bool; reads can return a value, null, or an array. Errors follow the service’s error_handling setting and may produce WP_Error.

Accepted identifiers

Pass a WordPress admin menu slug string, such as 'tools.php', 'edit.php?post_type=page', or a registered plugin page slug. Use get_items() to see available slugs after the admin menu has been built. The visible menu label is not the identifier.

Example

$menu = AAM::api()->backend_menu('role:author');
$menu->deny('tools.php');
$blocked = $menu->is_denied('tools.php');

This blocks the Tools admin menu item for Authors. $blocked checks the effective decision for the tools.php menu slug.

Developer notes

Behavior and parameters