Skip to main content

benecaster_support_mode_enabled

Action Free

Fires when Support Mode is switched on, after the seven-day auto-disable has been scheduled. It fires on every enable, including re-enabling after a previous manual or automatic switch-off.

Use it to turn your own logging up alongside ours. If your add-on keeps a debug log or diagnostic recorder, enabling it here means that when a customer sends us a diagnostic snapshot your add-on’s output is in it — which is the difference between diagnosing their problem and asking them to reproduce it.

To read the current state outside a callback, use SupportMode::is_active() rather than checking storage yourself.

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 Benecaster's 7-day cutoff so the add-on never logs past
        // the same window, even if Benecaster'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' );
    }
);

Need this built rather than just documented? See our services →