Complete reference of all public WordPress hooks exposed by Order Daemon. All hook names are prefixed odcm_.
Usage guidelines:
- All hooks listed here are stable public API – backward compatibility guaranteed.
- Honor capability checks for premium-gated features – the registry handles tier-based access control automatically.
- Do not rely on undocumented internal hooks.
Component registration hooks
odcm_register_components
Type: Action
Purpose: Register custom triggers, conditions, and actions at once.
When it fires: Lazily – inside RuleComponentRegistry::load_components(), which runs the first time the registry is accessed (i.e., when the Rule Builder page loads or the components REST endpoint is called). Register your hook at plugin init or load time; it will fire when the registry is first needed.
add_action('odcm_register_components', function ($registry) {
$registry->register_trigger(new VendorPluginRulesMyTrigger());
$registry->register_condition(new VendorPluginRulesMyCondition());
$registry->register_action(new VendorPluginRulesMyAction());
});odcm_register_triggers
Type: Action
Purpose: Register custom Trigger components.
add_action('odcm_register_triggers', function ($registry) {
$registry->register_trigger(new VendorPluginRulesMyTrigger());
});odcm_register_conditions
Type: Action
add_action('odcm_register_conditions', function ($registry) {
$registry->register_condition(new VendorPluginRulesMyCondition());
});odcm_register_actions
Type: Action
add_action('odcm_register_actions', function ($registry) {
$registry->register_action(new VendorPluginRulesMyAction());
});Rule builder and persistence hooks
odcm_rule_builder_config
Type: Filter
Purpose: Adjust Rule Builder UI configuration before it is passed to the frontend.
add_filter('odcm_rule_builder_config', function (array $config): array {
$config['ui']['my_plugin_enabled'] = true;
return $config;
});odcm_rule_builder_triggers / odcm_rule_builder_conditions / odcm_rule_builder_actions
Type: Filter
Purpose: Filter the list of available components in the Rule Builder.
add_filter('odcm_rule_builder_triggers', function (array $triggers): array {
$triggers['my_custom_trigger'] = new MyCustomTrigger();
return $triggers;
});odcm_before_rule_validation
Type: Filter
Purpose: Adjust rule payload before server-side validation.
add_filter('odcm_before_rule_validation', function (array $rule, $rule_id, $post) {
if (empty($rule['title'])) {
$rule['title'] = __('Default Rule Title', 'order-daemon');
}
return $rule;
}, 10, 3);odcm_before_rule_save
Type: Filter
Purpose: Sanitize or transform rule data right before persistence.
add_filter('odcm_before_rule_save', function (array $rule, $rule_id, $post) {
unset($rule['experimental']);
return $rule;
}, 10, 3);odcm_allow_unknown_component
Type: Filter
Purpose: Allow unknown components to be saved neutrally instead of causing validation errors.
$should_allow = apply_filters('odcm_allow_unknown_component', false, $component_type, $component_id);odcm_after_rule_save
Type: Action
Purpose: React after a rule has been successfully saved (e.g. sync to external system).
add_action('odcm_after_rule_save', function (array $data, int $rule_id, WP_Post $post) {
// push update to external system
}, 10, 3);Gateway and webhook integration hooks
odcm_register_gateway_adapters
Type: Action
Purpose: Register webhook gateway adapters with the Event Router.
use OrderDaemonCompletionManagerCoreEventsAdaptersAbstractGatewayAdapter;
add_action('odcm_register_gateway_adapters', function ($router) {
$adapter = new class extends AbstractGatewayAdapter {
public function __construct() {
parent::__construct('my-gateway');
}
public function getSupportedEventTypes(): array {
return ['payment_completed', 'payment_failed', 'subscription_renewed'];
}
public function canHandle(array $input): bool {
return isset($input['payload']['gateway']) && $input['payload']['gateway'] === 'my-gateway';
}
public function validateAuthenticity(array $input): bool {
$provided = $input['headers']['x-custom-signature'] ?? '';
$secret = get_option('custom_gateway_webhook_secret', '');
$expected = hash_hmac('sha256', json_encode($input['payload']), $secret);
return hash_equals($expected, $provided);
}
public function normalize(array $input): array {
$payload = $input['payload'] ?? [];
$event = new OrderDaemonCompletionManagerCoreEventsUniversalEvent([
'eventType' => $this->mapEventType($payload['event_type'] ?? ''),
'sourceGateway' => 'my-gateway',
'primaryObjectType' => 'order',
'primaryObjectID' => $payload['order_id'] ?? null,
'amount' => $payload['amount'] ?? null,
'currency' => $payload['currency'] ?? 'USD',
'rawData' => $payload,
]);
return [$event];
}
protected function mapEventType(string $gateway_event): string {
return [
'payment.completed' => 'payment_completed',
'payment.failed' => 'payment_failed',
'subscription.renewed' => 'subscription_renewed',
][$gateway_event] ?? 'custom_event';
}
protected function extractTransactionId(array $payload): ?string {
return $payload['transaction_id'] ?? null;
}
protected function extractGatewaySpecificMetadata(array $input): array {
return ['event_type' => $input['payload']['event_type'] ?? null];
}
};
$router->registerAdapter($adapter);
});odcm_webhook_test_event_types
Type: Filter
Purpose: Alter the list of test event types available in the admin test tools.
add_filter('odcm_webhook_test_event_types', function (array $types, string $gateway) {
if ($gateway === 'my-gateway') {
$types['custom_event'] = __('Custom Event Type', 'order-daemon');
}
return $types;
}, 10, 2);odcm_webhook_test_payload
Type: Filter
Purpose: Provide a custom test payload for a given gateway + event type.
add_filter('odcm_webhook_test_payload', function ($payload, string $gateway, string $event) {
if ($gateway === 'my-gateway' && $event === 'custom_event') {
return ['order_id' => 1234, 'event' => 'custom_processing'];
}
return $payload;
}, 10, 3);Dashboard and diagnostics hooks
odcm_register_additional_diagnostics
Type: Filter
Purpose: Register additional diagnostic checks.
odcm_insight_dashboard_accordion_state
Type: Filter
Purpose: Control the open/closed state of sections in the Insight dashboard.
$state = apply_filters('odcm_insight_dashboard_accordion_state', array $state);odcm_debug_source_labels
Type: Filter
Purpose: Adjust labels used for debug source badges in the Insight UI.
odcm_insight_dashboard_settings_sections
Type: Action
Purpose: Inject additional settings sections into the Insight dashboard settings area.
odcm_register_extensions Pro
Type: Action
Purpose: Register Pro extensions with the extension registry.
odcm_is_premium_user Pro
Type: Filter
Purpose: Controls whether Pro admin UI features are visible in the Insight Dashboard (log retention, export, advanced filtering). Defaults to false; the Pro plugin’s licensing system sets this to true when a valid license is active. Return true to grant access without a license check (e.g., in development).
Attribution and performance hooks
odcm_enable_context_cache
Type: Filter
Purpose: Enable/disable caching for context building.
$enabled = (bool) apply_filters('odcm_enable_context_cache', true);odcm_attribution_context
Type: Filter
Purpose: Inspect or alter the attribution context array used for evaluations.
odcm_enable_deep_attribution
Type: Filter
Purpose: Toggle more expensive backtrace attribution.
odcm_attribution_backtrace_limit
Type: Filter
Purpose: Limit the number of call stack frames inspected during deep attribution.
$limit = (int) apply_filters('odcm_attribution_backtrace_limit', 20);odcm_attribution_time_budget_ms
Type: Filter
Purpose: Millisecond budget for deep attribution work.
$ms = (int) apply_filters('odcm_attribution_time_budget_ms', 25);odcm_allow_backtrace_for_attribution
Type: Filter
Purpose: Allow backtrace usage in production.
$allowed = apply_filters('odcm_allow_backtrace_for_attribution', false);odcm_process_lifecycle_families
Type: Filter
Purpose: Alter process lifecycle family definitions for timeline correlation.
Event processing hooks
odcm_event_type_filter_options
Type: Filter
Purpose: Alter the list of available event types in the admin UI.
odcm_log_event_types
Type: Filter
Purpose: Modify the registered log event types.
odcm_timeline_adapter_event_type
Type: Filter
Purpose: Modify the event type before adapter selection.
odcm_timeline_adapter_selection
Type: Filter
Purpose: Override adapter selection for a specific event type.
odcm_timeline_adapter_selected
Type: Action
Purpose: React after an adapter has been selected for an event.
Signature: do_action('odcm_timeline_adapter_selected', $adapter, string $event_type, array $payload)
odcm_timeline_adapter_cache_cleared
Type: Action
Purpose: React after the adapter cache has been cleared.
odcm_update_rule_execution_event
Type: Action
Purpose: Update rule execution events in the timeline.
Signature: do_action('odcm_update_rule_execution_event', string $event_id, array $rule_payload)
odcm_rule_component_missing
Type: Filter
Purpose: Handle a missing rule component gracefully.
Logging hooks
odcm_log_error
Type: Action
Signature: do_action('odcm_log_error', string $message)
odcm_log_security_warning
Type: Action
Signature: do_action('odcm_log_security_warning', string $message)
odcm_log_debug
Type: Action
Signature: do_action('odcm_log_debug', string $message)
Debug hooks
odcm_debug_enabled
Type: Filter
Purpose: Control whether debug logging is active.
$enabled = apply_filters('odcm_debug_enabled', defined('ODCM_DEBUG') && ODCM_DEBUG);Complete integration example
class CRMIntegration {
public function __construct() {
add_action('odcm_register_components', [$this, 'register_components']);
add_action('odcm_after_rule_save', [$this, 'sync_to_crm'], 10, 3);
}
public function register_components($registry): void {
$registry->register_condition(new CRMCustomerStatusCondition());
$registry->register_action(new SyncOrderToCRMAction());
}
public function sync_to_crm(array $data, int $rule_id, WP_Post $post): void {
// $data['trigger'] is an object: { 'id' => '...', 'settings' => [...] }
if (($data['trigger']['id'] ?? '') === 'order_processing') {
sync_rule_with_crm($rule_id, $data);
}
}
}
// Guard against running on older Core versions
if (defined('ODCM_VERSION') && version_compare(ODCM_VERSION, '2.0.0', '>=')) {
new CRMIntegration();
} else {
add_action('admin_notices', function () {
echo '<div class="notice notice-warning"><p>CRM Integration requires Order Daemon v2.0.0 or higher.</p></div>';
});
}Best practices
- Wrap component registration in try-catch to prevent one failing component from breaking the registry.
- Keep
should_trigger(),evaluate(), andexecute()fast – avoid heavy queries. - Generate stable idempotency keys in gateway adapters to prevent duplicate processing.
- Include
process_idinodcm_log_event()calls to correlate related events in the Insight timeline. - Pro component availability is determined by whether the Pro plugin is active – no runtime entitlement check is needed in custom components.
- Return the original value from filters on error; never swallow exceptions silently.