WordPress Hooks and Custom Tool Integration
The verified extension surface includes tool registration/execution filters, response metrics action, semantic routing filters, and a private updater URL override.
The verified extension points allow a companion plugin to register tool definitions, implement a namespaced WordPress filter tool, observe response metrics, or adjust semantic routing. Keeping this code outside SmartSite preserves updates. A callback must still validate arguments, enforce authorization, minimize returned data, handle timeouts/errors, and avoid duplicate side effects.
The practical starting point is to create a companion plugin; do not edit smartsite core. Continue through the workflow until you test disabled/admin execution, then enable a narrow production scope, then use the field notes below to understand which choices affected AI output and which only changed delivery, access, or presentation.
What this feature does and when to use it
Section titled “What this feature does and when to use it”Use these hooks in a small companion plugin so SmartSite core files remain updateable.
Use this feature in the following situations:
- A built-in tool type cannot safely provide the required site-specific integration.
- You need sanitized operational metrics without modifying the SmartSite logger.
- You are experimentally tuning semantic routing with a controlled regression suite.
Where to find it
Section titled “Where to find it”Before you begin
Section titled “Before you begin”- A staging site and source control.
- Capability to write/test WordPress PHP securely.
- A reviewed tool schema and authorization/data-minimization design.
Set it up step by step
Section titled “Set it up step by step”- Create a companion plugin; do not edit SmartSite core.
- Use smartsite_register_tools to append a fully shaped tool definition.
- For a WordPress Hook tool, attach a callback to smartsite_tool_{name} and return a serializable result.
- Validate arguments, authorization, idempotency, timeouts, and output inside the callback.
- Use smartsite_ai_response_metrics for sanitized operational observation if needed.
- Change routing filters only with regression tests.
- Test disabled/admin execution, then enable a narrow production scope.
Fields, controls, and important values
Section titled “Fields, controls, and important values”These extension points can change routing, tool availability, metrics, and update behavior across many conversations. A routing or tool filter may directly affect what context the model receives and therefore change its answers; a metrics action only observes the result. Treat each hook according to that role, validate inputs, and test representative requests before enabling a site-wide extension.
| Field, control, or status | What SmartSite Assistant does with it | How to use it and why it matters |
|---|---|---|
| smartsite_register_tools | Filters stored + programmatic tool definitions in multiple manager flows. | This filter can add or alter tool definitions seen by manager flows. A definition changes what the model may choose, so keep schemas narrow and ensure the implementation is registered consistently wherever the filtered collection is consumed. |
| smartsite_tool_{name} | Filter called as apply_filters(name, null, $arguments); callback receives null then argument array. | A namespaced filter implements the WordPress-backed tool and receives null followed by the argument array. Validate that array, enforce authorization, return only necessary data, and make side effects safe before advertising the tool to the model. |
| smartsite_ai_response_metrics | Action emitted by the conversation logger with performance, context, and result/error information. | This action observes logged performance, context, success, and error information after a response. It is suitable for monitoring and does not change the answer already produced; callbacks should still avoid copying sensitive conversation data unnecessarily. |
| Routing filters | smartsite_hybrid_routing_mode, smartsite_hybrid_preflight_percentage, smartsite_semantic_router_model/history_limit/min_confidence. | Changing “Routing filters” can alter capability, wording, speed, cost, or language, but it cannot fill gaps in the knowledge base. Compare the same realistic prompts before deciding that a model or translation choice is an improvement. |
| smartsite_update_metadata_url | Developer-only private update endpoint override; package host trust follows it. | This override points the private updater at different metadata, and package-host trust follows that choice. Restrict it to controlled development or distribution infrastructure because a convenient URL change alters the software supply path rather than AI behavior. |
How to confirm it is working
Section titled “How to confirm it is working”Judge WordPress Hooks and Custom Tool Integration where its effect is actually consumed—by the administrator, visitor, model, or connected service. The expected result above is more useful than a green badge because it describes the behavior the configuration was meant to produce.
Practical example
Section titled “Practical example”A hook tool can call an internal booking service from trusted server code and return a sanitized availability object.
Recommended practice
Section titled “Recommended practice”- Change one part of WordPress Hooks and Custom Tool Integration at a time and keep a short record of the previous value and test result.
- Verify the saved result in the screen, visitor session, or connected service that actually consumes the setting.
Important warnings
Section titled “Important warnings”Common problems and focused checks
Section titled “Common problems and focused checks”| Problem | What to check and what to do next |
|---|---|
| WordPress Hooks and Custom Tool Integration is missing or does not match this guide. | Confirm the plugin is active and the account can manage WordPress options. Trace the request through capability, nonce or public validation, storage, runtime consumption, and error handling. |
| A change on WordPress Hooks and Custom Tool Integration does not produce the expected result. | Keep the exact notice and test case, then review the browser console and WordPress/PHP log. Trace the request through capability, nonce or public validation, storage, runtime consumption, and error handling. |
Commands
Section titled “Commands”Minimal hook callback shape
Section titled “Minimal hook callback shape”add_filter('smartsite_tool_lookup_availability', function ($result, $arguments) { // Validate, authorize, call the service, and sanitize output. return ['available' => false];}, 10, 2);Screen reference
Section titled “Screen reference”- Capture
- Show the WordPress Hook Action form with name lookup_availability and a side annotation mapping it to smartsite_tool_lookup_availability.
- Show
- Tool name/action, parameters, filter name mapping, Enabled off
- Viewport
- Desktop, 1440 × 900
- Annotate
- Use numbered callouts only for controls referenced in the procedure.
- Redact
- OpenAI keys, tokens, secrets, personal information, private URLs, IP addresses, and conversation text