VAT
Your cart

Your cart is empty.

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_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).

ArgumentTypeDescription
$listarray<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.

ArgumentTypeDescription
$post_typesstring[]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.

ArgumentTypeDescription
$urlstringLink target.
$user\WP_UserFound 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.

ArgumentTypeDescription
$allarrayDefinitions: 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.

ArgumentTypeDescription
$site_idsint[]Site ids the user can reach.
$user_idintUser 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.

ArgumentTypeDescription
$providersSearchProviderInterface[]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.

ArgumentTypeDescription
$itemarray<string, mixed>Result: id, title, subtitle, url, badge.
$provider_idstringProvider id, for example orders or content.
$querystringNormalised 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.

ArgumentTypeDescription
$listarray<int, array{id: string, keys: string, label: string, url: string, action: string}>Shortcuts.
add_filter( 'adba_shortcuts', function ( $list ) {
	return $list;
} );

Ready to connect your AI to real tools?

Start free trial