Hooks & Filters

Developer

Cronix PRO provides a set of WordPress actions and filters so you can hook into its behavior, extend functionality, and integrate with other systems — without modifying plugin files.

Add your custom code to a mu-plugin or a dedicated plugin of your own — never edit Cronix PRO files directly, as your changes will be overwritten on the next update.

#Actions

Actions fire at specific points in the Cronix PRO lifecycle. Use add_action() to hook into them.

Hook When it fires Parameters
cronix_event_tracked After an execution is recorded in the log $hook (string), $log_entry (array)
cronix_health_calculated After the health score is computed $score (int), $factors (array)
cronix_orphan_detected When an orphaned hook is found $hook (string)
cronix_notification_sent After a notification is dispatched $channel (string), $alert_type (string), $data (array)
cronix_chain_step_complete After a chain step finishes $chain_id (int), $step_index (int), $status (string)
cronix_snapshot_taken After a snapshot is saved $snapshot_id (int), $name (string)
cronix_quota_breached When a resource quota limit is exceeded $source (string), $violation_type (string), $value (mixed)

Example — log a message whenever an event fails:

add_action( 'cronix_event_tracked', function( $hook, $log_entry ) {
    if ( $log_entry['status'] === 'error' ) {
        error_log( "Cronix: $hook failed: " . $log_entry['error_message'] );
    }
}, 10, 2 );

#Filters

Filters let you modify data before Cronix PRO uses it. Use add_filter() to hook into them.

Filter What it controls Parameters
cronix_health_factors Modify health score factors before calculation $factors (array)
cronix_notification_data Modify notification payload before sending $data (array), $channel (string)
cronix_log_retention_days Override the log retention period $days (int)
cronix_overdue_threshold_minutes Override the overdue detection threshold $minutes (int)
cronix_excluded_hooks Add hooks that Cronix PRO should ignore entirely $hooks (array)
cronix_safe_mode_exclusions Hooks to keep running even in Safe Mode $hooks (array)
cronix_health_score Modify the final computed score before display $score (int)
cronix_plugin_detection Customize which plugin a hook is attributed to $source (string), $hook (string)

Example — exclude an internal maintenance hook from the Events Manager:

add_filter( 'cronix_excluded_hooks', function( $hooks ) {
    $hooks[] = 'my_internal_maintenance_hook';
    return $hooks;
});

Example — add a custom field to Slack notification payloads:

add_filter( 'cronix_notification_data', function( $data, $channel ) {
    if ( $channel === 'slack' ) {
        $data['site_env'] = defined( 'WP_ENV' ) ? WP_ENV : 'production';
    }
    return $data;
}, 10, 2 );
Filters that pass multiple parameters require the correct $accepted_args count in add_filter(). For example, cronix_notification_data passes 2 parameters, so use: add_filter( 'cronix_notification_data', 'my_function', 10, 2 ).

Last updated

Was this article helpful?

On this page

FIND THE ONE THAT FITS YOUR PROJECT

Import a demo, swap the content, adjust the layout. Modern WordPress under the hood, fast even when the site fills up.