Admin toolbar

Overview

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

PHP class: AAM_Framework_Service_AdminToolbar.

Method reference

Method Purpose
get_items() List discovered items.
items() Alias of get_items().
get_item($slug) Get one discovered item.
item($item_id) Alias of get_item().
deny($item_id) Store a deny rule.
allow($item_id) Store an allow rule.
reset($item_id = null) Reset toolbar rules for this level.
is_denied($slug) Check the effective deny decision.
is_allowed($item_id) 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 the toolbar node ID as a string, for example 'wp-logo' or 'my-account'. Use get_items() to discover IDs after WordPress populates the toolbar. A node’s visible title or URL is not its identifier.

Example

$toolbar = AAM::api()->admin_toolbar('role:subscriber');
$toolbar->deny('wp-logo');
$hidden = $toolbar->is_denied('wp-logo');

This hides the wp-logo toolbar node for Subscribers. $hidden reads the role’s effective decision for that node.

Developer notes

Behavior and parameters