Command palette
Copy class-command-palette.php and js/command-palette{.min}.js into the plugin’s admin directory. Change the PHP namespace and keep the JavaScript identical across consumers. The integration runs on WordPress 6.9+ where Core enqueues its admin palette. Network admin requires allow_network and capabilities appropriate to the network scope.
Navigation
Declare each shortcut explicitly. Search Core’s palette and compare destinations before adding one. Reuse a banner URL when it points to the intended destination.
new Command_Palette(
array(
'prefix' => 'wzio',
'product_label' => __( 'Image Optimizer', 'webberzone-image-optimizer' ),
'commands' => array(
array(
'slug' => 'delivery-settings',
'label' => __( 'Delivery settings', 'webberzone-image-optimizer' ),
'keywords' => array( 'wzio', 'webp', 'avif' ),
'url' => admin_url( 'upload.php?page=wzio-settings#delivery' ),
),
),
)
);
Use the full product name without “WebberZone” in product_label and put abbreviations in keywords. The registrar builds IDs as webberzone/{prefix}/{slug}. Navigation accepts absolute HTTP(S) URLs and optionally open_in_new_tab. The default capability is manage_options. Override it with the destination’s capability at registrar or command level.
AJAX actions
Set type to action and provide ajax_action, nonce_action, nonce_field, confirm_message, success_message, and error_message. Translate the three messages in the consuming plugin. Use an existing authenticated handler for a safe, idempotent operation. The handler must independently check its nonce and capability and respond using wp_send_json_success() or wp_send_json_error(). The registrar posts the action and nonce. Cancellation sends no request. The client blocks concurrent requests for the same command and displays and announces the outcome. Keep destructive and batch operations on their dedicated admin screens.
Extensions and asset compatibility
Use {$prefix}_command_palette_commands to add or remove raw definitions before validation. Add premium commands through that filter from includes/pro/; both editions use the same registrar.
Compatible copies use one script handle and append their own inline registration. When making a breaking change to the client payload, increment the compatibility number in both the WordPress handle and JavaScript registrar name. Regenerate the minified script whenever the source changes.