Search and palette hooks
This page lists the 11 hooks of this group. Each entry shows its type, the version it arrived in, where it runs, its arguments and a starting point.
adba_commandsadba_customers_urladba_search_content_skipadba_search_customer_urladba_search_filtersadba_search_network_sitesadba_search_page_afteradba_search_page_beforeadba_search_providersadba_search_resultadba_shortcuts
adba_commands
FilterSince 1.0.0 Runs in src/Modules/Search/Commands.php.
Filters the palette commands.
A command is an array with id, label, keywords, url and group. Since 2.11.0 it may also have params (steps the palette asks for: name, type order, product, user, choice or text, label, and options for a choice), endpoint (route below adba/v1 that receives the values as a POST, with {name} placeholders, used instead of url), done (toast text), screens (screen ids or bases where it shows on top) and context (order or product: about the object of this screen, its first param of that type is filled in).
| Argument | Type | Description |
|---|---|---|
$list | array<int, array<string, mixed>> | Commands. |
add_filter( 'adba_commands', function ( $list ) {
return $list;
} );
adba_customers_url
FilterSince 1.0.0 Runs in src/Modules/Search/Destinations.php.
The customers list: WooCommerce Customers when it exists, the users list otherwise.
add_filter( 'adba_customers_url', function ( ) {
return $value;
} );
adba_search_content_skip
FilterSince 1.3.0 Runs in src/Modules/Search/ContentProvider.php.
Filters the post types the content search leaves out. Products and orders have their own providers.
| Argument | Type | Description |
|---|---|---|
$post_types | string[] | Post type slugs. |
add_filter( 'adba_search_content_skip', function ( $post_types ) {
return $post_types;
} );
adba_search_customer_url
FilterSince 1.0.0 Runs in src/Modules/Search/CustomerProvider.php.
Filters where a customer search result links to. Defaults to the user edit screen.
| Argument | Type | Description |
|---|---|---|
$url | string | Link target. |
$user | \WP_User | Found user. |
add_filter( 'adba_search_customer_url', function ( $url, $user ) {
return $url;
}, 10, 2 );
adba_search_filters
FilterSince 1.0.0 Runs in src/Modules/Search/SearchService.php.
Filters the search subfilters per provider type.
| Argument | Type | Description |
|---|---|---|
$all | array | Definitions: type => key => {label, options: value => label}. |
add_filter( 'adba_search_filters', function ( $all ) {
return $all;
} );
adba_search_network_sites
FilterSince 2.2.0 Runs in src/Modules/Search/NetworkSearch.php.
Filters the sites a network search runs on (multisite).
Remove sites to keep them out of the search. Sites the user cannot reach are never added, whatever this returns.
| Argument | Type | Description |
|---|---|---|
$site_ids | int[] | Site ids the user can reach. |
$user_id | int | User id. |
add_filter( 'adba_search_network_sites', function ( $site_ids, $user_id ) {
return $site_ids;
}, 10, 2 );
adba_search_page_after
ActionSince 1.0.0 Runs in templates/search/page.php.
Fires at the end of the search page, inside its wrap. The Help module prints the help here for browsers without JavaScript.
add_action( 'adba_search_page_after', function ( ) {
// ...
} );
adba_search_page_before
ActionSince 1.3.0 Runs in templates/search/page.php.
Fires at the top of the search page, under the title and before the search form.
add_action( 'adba_search_page_before', function ( ) {
// ...
} );
adba_search_providers
FilterSince 1.0.0 Runs in src/Modules/Search/SearchService.php.
Filters the search providers.
| Argument | Type | Description |
|---|---|---|
$providers | SearchProviderInterface[] | Provider instances, keyed or not. |
add_filter( 'adba_search_providers', function ( $providers ) {
return $providers;
} );
adba_search_result
FilterSince 1.3.0 Runs in src/Modules/Search/SearchService.php.
Filters one search result, after the provider and before the cache.
Return the item (title, url and the optional id, subtitle, badge) or false to drop it. Items without a title or url are dropped afterwards; the type is always the provider id.
| Argument | Type | Description |
|---|---|---|
$item | array<string, mixed> | Result: id, title, subtitle, url, badge. |
$provider_id | string | Provider id, for example orders or content. |
$query | string | Normalised query. |
add_filter( 'adba_search_result', function ( $item, $provider_id, $query ) {
return $item;
}, 10, 3 );
adba_shortcuts
FilterSince 1.0.0 Runs in src/Modules/Search/Shortcuts.php.
Filters the keyboard shortcuts.
| Argument | Type | Description |
|---|---|---|
$list | array<int, array{id: string, keys: string, label: string, url: string, action: string}> | Shortcuts. |
add_filter( 'adba_shortcuts', function ( $list ) {
return $list;
} );