﻿id	summary	reporter	owner	description	type	status	priority	milestone	component	version	severity	resolution	keywords	cc	focuses
66322	Command Palette: Add keywords to admin menu commands	jdeep		"The Command Palette registers a command for every admin menu item (#63845), but these commands can only be found by their label. Searching for ""favicon"", ""timezone"" or ""password"" finds nothing, even though Settings > General and Users > Profile are where those are.

The Command Palette has supported keywords since [https://github.com/WordPress/gutenberg/pull/70624 Gutenberg #70624]. When [https://github.com/WordPress/gutenberg/pull/71476 Gutenberg #71476] moved admin navigation to commands generated from the admin menu, there was no longer a way to attach keywords to them. That was listed as one of its trade-offs.

The proposal is that keywords come from PHP, next to the `label`, `url` and `name` that `wp_enqueue_command_palette_assets()` already sends.


== Proposed change ==

 * A new function, `wp_get_admin_menu_command_keywords()`, returns keywords for core admin screens, keyed by menu slug.
 * A new filter, `admin_menu_command_keywords`, lets plugins add keywords for their own pages. They key them by the same `$menu_slug` they pass to `add_menu_page()` or `add_submenu_page()`.
 * `wp_enqueue_command_palette_assets()` adds a `keywords` list to each top-level and submenu command. Commands without keywords get an empty list.

For example, a plugin could add:

{{{
add_filter(
        'admin_menu_command_keywords',
        function ( $keywords ) {
                $keywords['my-shop'] = array( 'orders', 'products' );
                return $keywords;
        }
);
}}}

The Gutenberg side, which passes the keywords through to the palette, is in [https://github.com/WordPress/gutenberg/pull/84834 Gutenberg #84834]."	enhancement	new	normal	Awaiting Review	Script Loader		normal		has-patch has-unit-tests		administration
