VAT
Your cart

Your cart is empty.

Shell, admin bar and preferences hooks

This page lists the 44 hooks of this group. Each entry shows its type, the version it arrived in, where it runs, its arguments and a starting point.

adba_account_menu_items

FilterSince 1.3.0 Runs in src/Modules/Shell/AdminBarNodes.php.

Filters the items Addofy adds to the account menu: theme, comfort, view and the native view link.

Each item is a WP_Admin_Bar::add_node() argument array with an id; use parent user-actions to land in the account menu. Log Out always stays last, whatever this filter returns.

An Off/On toggle built with AdminBarNodes::toggle_node() from AdminBarNodes::pref_url() links saves that one preference without a page load (data-adba-toggle and data-adba-url on its segments); without JavaScript the same links go through admin-post.php.

ArgumentTypeDescription
$itemsarray<int, array<string, mixed>>Node arguments, in order.
$screen_idstringCurrent screen id, empty for users without manage_options.
add_filter( 'adba_account_menu_items', function ( $items, $screen_id ) {
	return $items;
}, 10, 2 );

adba_active_palette

FilterSince 2.12.0 Runs in src/Design/Palettes.php.

Filters the active palette id of a scheme, for example per role or per site.

ArgumentTypeDescription
$palette_idstringPalette id from the constant, environment, setting or default.
$schemestring'dark' or 'light'.
$user_idintUser the palette is for.
add_filter( 'adba_active_palette', function ( $palette_id, $scheme, $user_id ) {
	return $palette_id;
}, 10, 3 );

adba_admin_bar_nodes

FilterSince 1.3.0 Runs in src/Modules/Shell/Shell.php.

Filters the admin bar nodes Addofy adds: search, notices and the account menu items.

Add, reorder or remove Addofy's nodes here. Nodes of WordPress and other plugins keep going through the native admin_bar_menu action. Addofy adds the sidebar toggle at priority 1, these nodes at priority 100 and tidies the account menu (Log Out last) at PHP_INT_MAX, so hook admin_bar_menu below or above 100 to place your own nodes before or after.

ArgumentTypeDescription
$nodesarray<int, array<string, mixed>>WP_Admin_Bar::add_node() argument arrays, in order.
$screen_idstringCurrent screen id.
add_filter( 'adba_admin_bar_nodes', function ( $nodes, $screen_id ) {
	return $nodes;
}, 10, 2 );

adba_adminbar_icons

FilterSince 2.4.0 Runs in src/Modules/Shell/AdminBarIcons.php.

Filters the icons of top-level admin bar nodes on mobile. Add the id of your node (without the wp-admin-bar- prefix) to give it the same line icon style as the rest of the bar.

ArgumentTypeDescription
$iconsarray<string, string>Node id => SVG path data on a 16px grid; it is stroked, not filled.
add_filter( 'adba_adminbar_icons', function ( $icons ) {
	return $icons;
} );

adba_alert_events

FilterSince 1.5.0 Runs in src/Modules/Alerts/Events.php.

Filters the events users can subscribe to on the notifications settings.

Each event is id => array( 'label' => …, 'group' => …, 'capability' => …, 'hook' => … ). Only users with the capability receive it. Since 2.36.0 'default_roles' (string[]) switches the event on for those roles until the site owner changes it under Notifications or a user chooses in their profile. When hook is set, the event fires on that action with its first argument as object id; leave hook empty and call adba_trigger_alert( $id, $object_id, $data ) yourself. Put a 'text' and 'url' in $data to control the line in the list. Ids are lowercase letters, digits and _.

ArgumentTypeDescription
$eventsarray<string, array<string, mixed>>Events keyed by id.
add_filter( 'adba_alert_events', function ( $events ) {
	return $events;
} );

adba_alert_sections

FilterSince 2.36.0 Runs in src/Modules/Alerts/Events.php.

Filters the sections of the notification list. Each section is id => array( 'label' => …, 'order' => … ) (order: lower comes first, default 50). Put an event in a section with 'section' => id in adba_alert_events. The site owner (and each user for themselves) can hide a section; its notifications then show under General. Ids are lowercase letters, digits and _; general is fixed.

ArgumentTypeDescription
$sectionsarray<string, array{label: string, order?: int}>Sections keyed by id.
add_filter( 'adba_alert_sections', function ( $sections ) {
	return $sections;
} );

adba_breadcrumbs

FilterSince 1.0.0 Runs in src/Modules/Design/Breadcrumbs.php.

Filters the breadcrumb items of a screen. Return an empty array to hide the trail.

ArgumentTypeDescription
$itemsarray<int, array{label: string, url: string}>Items; the last one is the current page.
$screenScreenCurrent screen.
add_filter( 'adba_breadcrumbs', function ( $items, $screen ) {
	return $items;
}, 10, 2 );

adba_char_counters

FilterSince 2.10.0 Runs in src/Modules/Qol/Qol.php.

Filters the fields that get a character counter. Each entry has a selector (a field or contenteditable box) or an editor (a TinyMCE editor id), and a limit: a number of characters, or 'title' or 'description' for the limits of the Quality of life settings. Addofy adds the SEO fields of Yoast and Rank Math through this filter.

ArgumentTypeDescription
$targetsarray<int, array<string, mixed>>Counter targets.
add_filter( 'adba_char_counters', function ( $targets ) {
	return $targets;
} );

adba_colorscan_css

FilterSince 2.31.5 Runs in src/Modules/ColorScan/Job.php.

Filters the generated override CSS of a plugin, per stylesheet key, before it is written.

ArgumentTypeDescription
$cssarray<string, string>CSS per stylesheet key (md5 of the path inside the plugin, without .min).
$slugstringPlugin folder.
add_filter( 'adba_colorscan_css', function ( $css, $slug ) {
	return $css;
}, 10, 2 );

adba_colorscan_done

ActionSince 2.31.5 Runs in src/Modules/ColorScan/Job.php.

Fires after the color scan of a plugin.

ArgumentTypeDescription
$slugstringPlugin folder.
$entryarray<string, mixed>Stored result: status, version, stats, id.
add_action( 'adba_colorscan_done', function ( $slug, $entry ) {
	// ...
}, 10, 2 );

adba_colorscan_plugins

FilterSince 2.31.5 Runs in src/Modules/ColorScan/Job.php.

Filters the plugins the color scan looks at, per plugin folder. Remove a folder to keep that plugin out of the scan for good, for example when it follows Addofy's tokens already.

ArgumentTypeDescription
$pluginsarray<string, array{name: string, file: string, version: string}>Plugins per folder.
add_filter( 'adba_colorscan_plugins', function ( $plugins ) {
	return $plugins;
} );

adba_colorscan_token

FilterSince 2.31.5 Runs in src/Modules/ColorScan/Job.php.

Filters the Addofy value a fixed plugin color becomes in the color scan. Return null to keep the plugin's color, or any CSS value (preferably an Addofy token, so it follows light and dark).

ArgumentTypeDescription
$valuestring|nullMapped value, null when the color stays.
$colorstringThe color as the plugin wrote it.
$rolestringbg, text, border or shadow.
$slugstringPlugin folder.
add_filter( 'adba_colorscan_token', function ( $value, $color, $role, $slug ) {
	return $value;
}, 10, 4 );

adba_copy_targets

FilterSince 2.10.0 Runs in src/Modules/Qol/Qol.php.

Filters what gets a copy button: a list of array( 'selector' => …, 'source' => …, 'label' => … ). The source is text (the visible text), value (a field), href (a link) or attr (the data-adba-copy attribute, so you can also mark your own elements with data-adba-copy="…"). The label finishes "Copy %s" for the button. Add the tracking code field of your shipping plugin here.

ArgumentTypeDescription
$targetsarray<int, array{selector: string, source: string, label: string}>Copy targets.
add_filter( 'adba_copy_targets', function ( $targets ) {
	return $targets;
} );

adba_count_cap

FilterSince 2.30.1 Runs in src/Support/Count.php.

Filters the highest number a counter shows (notices, notifications, menu badges). Above it the counter reads "999+"; the real number stays in its accessible label.

ArgumentTypeDescription
$capintDefault 999.
add_filter( 'adba_count_cap', function ( $cap ) {
	return $cap;
} );

adba_darkmode_wc_fragments

FilterSince 1.3.0 Runs in src/Modules/DarkMode/DarkMode.php.

Filters the screen id fragments that load the dark stylesheet for the WooCommerce admin (React header and cards). Add a fragment of your own screen when it uses WooCommerce admin components.

ArgumentTypeDescription
$fragmentsstring[]Screen id fragments.
$screen_idstringCurrent screen id.
add_filter( 'adba_darkmode_wc_fragments', function ( $fragments, $screen_id ) {
	return $fragments;
}, 10, 2 );

adba_density_auto_screens

FilterSince 2.7.0 Runs in src/Modules/Design/Design.php.

Filters the screens that are compact when the density is Automatic.

ArgumentTypeDescription
$patternsstring[]Screen ids or bases, as in Screen::matches().
$screenScreenCurrent screen.
add_filter( 'adba_density_auto_screens', function ( $patterns, $screen ) {
	return $patterns;
}, 10, 2 );

adba_die_page_classes

FilterSince 2.23.0 Runs in src/Modules/Design/DiePage.php.

Filters the classes on the body of a styled WordPress error page.

ArgumentTypeDescription
$classesstring[]Classes, at least adba, adba-die and the theme class.
add_filter( 'adba_die_page_classes', function ( $classes ) {
	return $classes;
} );

adba_editor_padding

FilterSince 2.14.1 Runs in src/Modules/Design/Design.php.

Filters the space around the block editor canvas on post, page and pattern screens. Return a CSS length ("24px"), or an empty string to turn the space off. The default is "var(–adba-space-4)" (16px; 12px on a phone). Not used by the site editor.

ArgumentTypeDescription
$paddingstringCSS length, or '' for none.
add_filter( 'adba_editor_padding', function ( $padding ) {
	return $padding;
} );

adba_empty_state

FilterSince 1.0.0 Runs in src/Modules/Design/Design.php.

Filters the empty-state data of a screen.

ArgumentTypeDescription
$statearray{text: string, action_label: string, action_url: string}Text and action; leave action_url empty for no button.
$screenScreenCurrent screen.
add_filter( 'adba_empty_state', function ( $state, $screen ) {
	return $state;
}, 10, 2 );

adba_focus_rules

FilterSince 2.6.0 Runs in src/Modules/Shell/Shell.php.

Filters what the focus view hides on top of the built-in rules: CSS selectors of elements that are in the way of one task, for example a banner of your plugin. They are hidden with display: none under body.adba.adba-focus, so the advanced and simple views still show them. Invalid selectors are dropped.

ArgumentTypeDescription
$rulesarray{hide: string[]}Rules: hide is a list of CSS selectors.
add_filter( 'adba_focus_rules', function ( $rules ) {
	return $rules;
} );

adba_frontend_admin_bar

FilterSince 2.30.1 Runs in src/Modules/Shell/FrontBar.php.

Filters whether the admin bar on the public site looks like the admin bar in the admin (colors of the user's theme, icons, account menu, bell). Return false when the theme styles the admin bar itself.

ArgumentTypeDescription
$enabledboolWhether the shell module is on and safe mode is off.
add_filter( 'adba_frontend_admin_bar', function ( $enabled ) {
	return $enabled;
} );

adba_guide_mode

FilterSince 2.9.0 Runs in src/Modules/Guide/Guide.php.

Filters when guides show: auto (a card on the first visit of a screen) or on_demand (only through the guide button in the page bar and the Guides tab in Help). The focus view always works on demand.

ArgumentTypeDescription
$modestringauto or on_demand, from Addofy > Appearance.
$user_idintCurrent user id.
add_filter( 'adba_guide_mode', function ( $mode, $user_id ) {
	return $mode;
}, 10, 2 );

adba_guides

FilterSince 2.9.0 Runs in src/Modules/Guide/GuideRegistry.php.

Filters the guides Addofy can show: a card on the first visit, a tour along the parts and a Help tab.

Add an array per guide with id (stable, lowercase), version (int, raise it to show the guide again with the badge New), screens (screen ids or bases, 'post_type:slug' or '*'), title, body (HTML, passed through wp_kses_post) and optional steps, each with target (CSS selector), title, body and placement (auto, top, bottom, left or right), and open (CSS selector of a menu, admin bar item or <details> the tour opens for that step and closes after it). Steps whose target is missing on the page are skipped. Only the guides for the current screen are shown: guides of the screen first, then those for every screen ('*'), each group by the optional order (default 10, lower first).

ArgumentTypeDescription
$guidesarray<int, array<string, mixed>>Guides of the active modules.
$screenScreenCurrent screen.
add_filter( 'adba_guides', function ( $guides, $screen ) {
	return $guides;
}, 10, 2 );

adba_help_tabs

FilterSince 1.0.0 Runs in src/Modules/Help/HelpTabs.php.

Filters the Addofy tabs of the Help panel.

ArgumentTypeDescription
$tabsarray<int, array{id: string, title: string, content: string, priority: int}>Tabs; content is HTML.
$contextarray<string, mixed>Context the tabs were built from.
add_filter( 'adba_help_tabs', function ( $tabs, $context ) {
	return $tabs;
}, 10, 2 );

adba_login_style

FilterSince 2.10.0 Runs in src/Modules/Design/Login.php.

Filters whether the login screen (wp-login.php, also inside the session expired dialog) gets the Addofy style. Return false when another plugin or the theme styles the login screen.

ArgumentTypeDescription
$enabledboolWhether the design module and its login setting are on.
add_filter( 'adba_login_style', function ( $enabled ) {
	return $enabled;
} );

adba_menu_groups

FilterSince 1.0.0 Runs in src/Modules/Shell/MenuGrouper.php.

Filters the sidebar groups.

ArgumentTypeDescription
$groupsarray<int, array{id: string, label: string, items: string[], icon?: string}>Groups: id, label (empty for no heading), menu slugs and an optional icon: a key of MenuIcons::SET or SVG path data on a 16px grid. The icon shows next to the heading.
add_filter( 'adba_menu_groups', function ( $groups ) {
	return $groups;
} );

adba_menu_icon_colors

FilterSince 1.3.0 Runs in src/Modules/Shell/Shell.php.

Filters the colors WordPress's svg-painter uses for SVG menu icons in the Addofy sidebar.

Keys light and dark, each with base, focus and current as hex colors. WordPress paints every SVG (data URI) menu icon with one palette, so this changes all of them; give your own icon a fixed color by using a dashicon or a CSS mask instead.

ArgumentTypeDescription
$colorsarray<string, array<string, string>>Palettes keyed by light and dark.
add_filter( 'adba_menu_icon_colors', function ( $colors ) {
	return $colors;
} );

adba_menu_locked_items

FilterSince 1.0.0 Runs in src/Modules/Shell/MenuGrouper.php.

Filters the menu slugs of the fixed AddoBase section at the bottom of the sidebar.

AddoBase and Addofy come first, in that order; slugs added by the filter follow them.

ArgumentTypeDescription
$itemsstring[]Menu slugs, in display order.
add_filter( 'adba_menu_locked_items', function ( $items ) {
	return $items;
} );

adba_mobile_adminbar_keep

FilterSince 2.8.0 Runs in src/Modules/Shell/MobileBar.php.

Filters the top-level admin bar nodes that keep their place on mobile (782px and below). Every other top-level node is hidden there and gets a copy in the account menu. Use node ids without the wp-admin-bar- prefix. my-account and top-secondary always stay.

ArgumentTypeDescription
$keepstring[]Node ids.
add_filter( 'adba_mobile_adminbar_keep', function ( $keep ) {
	return $keep;
} );

adba_notice_sources

FilterSince 1.0.0 Runs in src/Modules/Notices/Notices.php.

Filters the notice sources of the notice panel.

ArgumentTypeDescription
$sourcesarray<string, array{slug: string, name: string, match: string[]}>Sources keyed by slug.
add_filter( 'adba_notice_sources', function ( $sources ) {
	return $sources;
} );

adba_notice_take_selectors

FilterSince 2.4.0 Runs in src/Modules/Notices/Notices.php.

Filters the selectors of notices the notice panel collects anywhere in the content area, also when they are inline or sit inside a form. Use it for a plugin notice that is printed outside the usual spot; a notice that contains form fields still stays on the page.

ArgumentTypeDescription
$selectorsstring[]CSS selectors.
add_filter( 'adba_notice_take_selectors', function ( $selectors ) {
	return $selectors;
} );

adba_notices_per_section

FilterSince 2.30.1 Runs in src/Modules/Notices/Notices.php.

Filters how many notices each group of the notice panel shows before "Show more". The counters keep the full number.

ArgumentTypeDescription
$countintDefault 5.
add_filter( 'adba_notices_per_section', function ( $count ) {
	return $count;
} );

adba_pagebar_action_icons

FilterSince 2.4.0 Runs in src/Modules/Design/TitleActionIcons.php.

Filters the icons of the buttons next to the page title on phones, where they are square icon buttons. The key follows the URL of the button: add, import, export, edit (user-edit.php or a link with the class adba-title-edit); every other button uses "generic".

ArgumentTypeDescription
$iconsarray<string, string>Action key => SVG path data on a 24px grid (filled).
add_filter( 'adba_pagebar_action_icons', function ( $icons ) {
	return $icons;
} );

adba_pagebar_actions

FilterSince 1.0.0 Runs in src/Modules/Design/PageBar.php.

Filters the icon buttons of the page bar. Add a button only on screens where it does something.

ArgumentTypeDescription
$actionsarray<int, array<string, mixed>>Buttons: id, label, icon (SVG path data on a 24px grid or a dashicons-* class), url or target (CSS selector of a native control to click), controls (panel id), priority.
$screenScreenCurrent screen.
add_filter( 'adba_pagebar_actions', function ( $actions, $screen ) {
	return $actions;
}, 10, 2 );

adba_palette_tokens

FilterSince 2.12.0 Runs in src/Design/Palettes.php.

Filters the derived color tokens of a palette right before they are printed.

Only color tokens from the allowlist with a valid color value survive.

ArgumentTypeDescription
$tokensarray<string, string>Custom property name => color.
$palette_idstringPalette id.
$schemestring'dark' or 'light'.
add_filter( 'adba_palette_tokens', function ( $tokens, $palette_id, $scheme ) {
	return $tokens;
}, 10, 3 );

adba_register_palettes

ActionSince 2.25.0 Runs in src/Design/PaletteRegistry.php.

Register color palettes. Call $palettes->add( $id, $args ) with a label, a scheme ('dark' or 'light'), five colors (background, text, accent, accent_2, hover; accent_2 may be ''), optional token overrides and an optional family: give a dark and a light palette the same family to pair them. A dark palette without a light partner gets a derived one. Addofy derives the full token set and fixes contrast.

ArgumentTypeDescription
$palettesPaletteRegistryThe registry.
add_action( 'adba_register_palettes', function ( $palettes ) {
	// ...
} );

adba_row_title_parts

FilterSince 2.35.0 Runs in src/Modules/Shell/TitleParts.php.

Filters the markup before and after the title in the product and order lists: the product name, the order number with the buyer. For example an action button after the title. Return HTML per side (it goes through wp_kses_post) or an empty string for nothing. The markup sits in a span with the class adba-title-before or adba-title-after (plus no-link, so a click there does not open the order). Runs once per row, only on the lists Addofy styles.

ArgumentTypeDescription
$partsarray{before: string, after: string}HTML before and after the title, empty by default.
$list_idstringList id: products or orders.
$object\WC_Product|\WC_OrderProduct or order of the row.
add_filter( 'adba_row_title_parts', function ( $parts, $list_id, $object ) {
	return $parts;
}, 10, 3 );

adba_simple_mode

FilterSince 1.2.0 Runs in src/Modules/Shell/SimpleMode.php.

Filters the rules of the simple view. Each area keeps its shape (see SimpleMode::defaults()): add a slug to menu.keep to keep a plugin's menu item out of "More", or an id to dashboard.keep. The administrator's choices in the Visibility tab are applied after this filter. Since 2.6.0 the areas also include submenu_hide, columns_hide, notices, pagebar, bulk_actions and product_tabs; since 2.24.0 new_content, and the second argument names the profile (shop, editorial or one of your own).

ArgumentTypeDescription
$rulesarray<string, mixed>Rules per area.
$profilestringProfile id.
add_filter( 'adba_simple_mode', function ( $rules, $profile ) {
	return $rules;
}, 10, 2 );

adba_simple_profiles

FilterSince 2.24.0 Runs in src/Modules/Shell/SimpleMode.php.

Filters the profiles of the simple view: id => array( 'label' => string, 'rules' => array ). The rules have the shape of SimpleMode::defaults(). Add a profile to offer it next to Shop and Editorial, or change the rules of one. Shop and Editorial always stay: a removed built-in profile is put back. Their label is empty here and filled in when shown; set one to rename them.

ArgumentTypeDescription
$profilesarray<string, array<string, mixed>>Profiles by id.
$signalsarray<string, bool>Site signals: recent_posts, comments_open.
add_filter( 'adba_simple_profiles', function ( $profiles, $signals ) {
	return $profiles;
}, 10, 2 );

adba_start_pages

FilterSince 2.10.0 Runs in src/Modules/Qol/StartPage.php.

Filters the start pages a user can choose after login, as key => array( 'label' => …, 'url' => … ). Keys are lowercase letters, digits, – and _; the url must be an admin URL of this site. Saved views are added after this filter.

ArgumentTypeDescription
$pagesarray<string, array{label: string, url: string}>Start pages.
$user\WP_UserUser the list is for.
add_filter( 'adba_start_pages', function ( $pages, $user ) {
	return $pages;
}, 10, 2 );

adba_style_die_pages

FilterSince 2.23.0 Runs in src/Modules/Design/DiePage.php.

Filters whether Addofy styles the WordPress error pages (wp_die()) in the admin.

ArgumentTypeDescription
$styleboolTrue to style them. Default true while the Design module is on.
add_filter( 'adba_style_die_pages', function ( $style ) {
	return $style;
} );

adba_task_labels

FilterSince 2.36.0 Runs in src/Modules/TaskToasts/TaskToasts.php.

Filters the texts of the progress toasts: add a REST route, an admin-ajax action or a form that reloads the page. A text with done '' closes the toast without a done message.

ArgumentTypeDescription
$labelsarray<string, mixed>Keys fallback, saved, rest, skip, ajax, forms and formText.
add_filter( 'adba_task_labels', function ( $labels ) {
	return $labels;
} );

adba_today_items

FilterSince 2.24.0 Runs in src/Modules/Today/TodayItems.php.

Filters the lines of the Today widget on the dashboard: id => array( 'label' => string, 'count' => int, 'url' => string ). Add a line for something of your plugin that needs doing; lines with a count of zero or less are left out after this filter, so return the count even when it is zero. Keep the count cheap or cache it: the widget shows on every dashboard visit.

ArgumentTypeDescription
$linesarray<string, array<string, mixed>>Lines by id.
$profilestringProfile of the simple view: shop, editorial or one of your own.
add_filter( 'adba_today_items', function ( $lines, $profile ) {
	return $lines;
}, 10, 2 );

adba_user_tabs

FilterSince 1.0.0 Runs in src/Modules/Users/UserTabs.php.

Filters the tabs of the user profile screens.

Each tab has an id, a label and a list of CSS selectors. A section that contains an element matching one of the selectors is shown in that tab. Sections that match nothing get their own tab, or go to Other.

ArgumentTypeDescription
$tabsarrayTabs, in order.
$woocommerceboolWhether WooCommerce is active.
add_filter( 'adba_user_tabs', function ( $tabs, $woocommerce ) {
	return $tabs;
}, 10, 2 );

Ready to connect your AI to real tools?

Start free trial