Skip to main content

benecaster_support_mode_enabled

Action Free Since v1.0.0

Fires from Benecaster\Admin\SupportMode::enable() after Support Mode is toggled on and the 7-day auto-disable cron event has been scheduled. Fires after the benecaster_support_mode_enabled wp_option is written to true and the benecaster_support_mode_auto_disable_at timestamp is set — on every enable, including re-enabling after a previous manual or automatic disable.

Use this hook to mirror Benecaster’s logging lifecycle in your add-on. If your add-on has its own debug logger or diagnostic recorder, enabling it here ensures that when a customer sends a diagnostic log snapshot, your add-on’s output is included. To read the current Support Mode state outside a hook callback, use Benecaster\Admin\SupportMode::is_active() rather than reading the option directly.

Parameters

Name Type Default Description
$auto_disable_at int Unix timestamp when the 7-day auto-disable cron is scheduled to fire

Examples

Enable verbose logging and mirror the auto-disable window

add_action(
    'benecaster_support_mode_enabled',
    function ( int $auto_disable_at ): void {
        update_option( 'my_addon_verbose_logging', true, false );

        // Mirror core's 7-day cutoff so the add-on never logs past
        // the same window, even if core's cron is rescheduled.
        wp_clear_scheduled_hook( 'my_addon_support_mode_cleanup' );
        wp_schedule_single_event( $auto_disable_at, 'my_addon_support_mode_cleanup' );
    }
);