The cmd-features plugin exposes the filter hooks below so a theme or companion plugin can adjust its behaviour without forking it. Register callbacks with add_filter() from your theme's functions.php.
Several of these filters run on values that are printed to the page. A callback that returns unescaped, attacker-influenced markup will introduce a cross-site scripting hole. Escape whatever you return.
Retrieval and AI responses
cmd_format_post_data
Filters the Markdown context block built from a single post before it is sent to the model. Use it to add or remove fields from the retrieved context.
$formatted_itemstring- The formatted context block, by default a Markdown heading followed by the post content.
$post_idint- ID of the post the block was built from.
add_filter( 'cmd_format_post_data', function ( $item, $post_id ) {
return $item . "\n\nURL: " . get_permalink( $post_id );
}, 10, 2 );cmd_rag_visible_taxonomy
Filters the taxonomy label displayed before a search result link. Returns an empty string by default, which hides the label.
$taxonomy_labelstring- Label to display. Empty by default.
$postWP_Post- The post being rendered as a result.
cmd_rag_rest_source
Filters one source entry before it is returned by the REST answer endpoint. Use it to add fields such as an excerpt or a featured image URL.
$source_entryarray- Source entry containing title and url keys.
$postWP_Post- The post the entry was built from.
cmd_filter_response
Filters the sanitised AI answer immediately before output. This is the last chance to rewrite, truncate or replace the answer.
$safe_answerstring- The sanitised answer text.
$wp_display_resultsarray- The result link markup that will be shown beneath the answer.
cmd_ai_response_heading_text
Filters the heading shown above an AI response. Defaults to "AI Response".
$heading_textstring- The heading text.
cmd_ai_response_disclaimer_text
Filters the disclaimer shown inside the AI response wrapper. Defaults to "AI can make mistakes. Please double-check responses."
$disclaimer_textstring- The disclaimer text.
ChatKit
cmd_chatkit_search_max_results
Filters how many results the ChatKit site_search tool may return. The filtered value is clamped to between 1 and 10, so a filter cannot widen the tool beyond its safe bounds.
$max_resultsint- Value of CMOPT_AI_CHATKIT_SEARCH_MAX_RESULTS, 3 by default.
cmd_chatkit_search_max_chars
Filters the character budget for the ChatKit site_search payload. The filtered value is clamped to between 500 and 200000.
$max_charsint- Value of CMOPT_AI_CHATKIT_SEARCH_MAX_CHARS, 24000 by default.
Contact Form 7 suggested replies
cmd_cf7_ai_skip_inquiry_field
Filters whether a submitted Contact Form 7 field is treated as noise and excluded from the enquiry context. Honeypots, mc4wp fields and auto-numbered field names are skipped by default.
$skipbool- Whether the field will be skipped.
$keystring- The submitted field name.
add_filter( 'cmd_cf7_ai_skip_inquiry_field', function ( $skip, $key ) {
return 'internal-ref' === $key ? true : $skip;
}, 10, 2 );cmd_cf7_ai_inquiry_field_label
Filters the human-readable label a Contact Form 7 field is given in the enquiry context. Known field names are mapped; anything else is title-cased.
$labelstring- The resolved display label.
$keystring- The submitted field name.
Option lifecycle
cmd_deprecated_option_names
Filters the list of retired option names deleted by the cleanup routine. Add any site-specific option names that should be purged from the options table. Deletion is idempotent and runs once per plugin version bump.
$namesstring[]- Option names slated for deletion.
add_filter( 'cmd_deprecated_option_names', function ( $names ) {
$names[] = 'CMOPT_MY_RETIRED_OPTION';
return $names;
} );Settings screen
The settings screen renders itself from the options documentation file. These filters adjust how it reads that file and how it groups what it finds.
cmd_cmopt_registry_path
Filters the absolute path of the JSON file describing the options. An option that file does not describe is not rendered on the settings screen, so this filter effectively controls which options are editable.
$pathstring- Absolute path to the options documentation file.
cmd_cmopt_sub_namespaces
Filters the name segments treated as a sub-system when the settings screen derives its sections. A segment listed here splits its options into their own section, so CMOPT_AI_CF7_* fields group separately from the rest of the AI options rather than collapsing into one long list.
$tokensstring[]- Uppercase name segments, CF7 and CHATKIT by default.
add_filter( 'cmd_cmopt_sub_namespaces', function ( $tokens ) {
$tokens[] = 'MYFEATURE';
return $tokens;
} );cmd_cmopt_section_labels
Filters the display titles of the settings sections. A section with no entry here is title-cased from its name segment, so a new group gets a readable heading without any code change.
$labelsarray- Map of section key to display title.
