Skip to main content

benecaster_license_cron_complete

Action Free Since v1.0.0

Fires once at the very end of every daily license validation cron run, regardless of outcome — valid response, explicit rejection, server unreachable, or malformed response. All outcome-specific hooks ([benecaster_license_validated](/hooks/benecaster_license_validated/), [benecaster_license_invalid](/hooks/benecaster_license_invalid/), [benecaster_validation_failure](/hooks/benecaster_validation_failure/)) have already fired before this hook. Takes no parameters.

The primary use case is attaching add-on health checks to the daily cron cycle without registering a separate cron event. When attaching health checks, use `NoticeManager::run_health_check()` rather than calling evaluate directly — this wraps the check in an exception-swallowing contract so a misbehaving check cannot prevent subsequent cron callbacks from running.

Examples

Attach add-on health check to daily cron

use Benecaster\Notices\NoticeManager;

add_action( 'benecaster_boot', function ( \Benecaster\Container $container ): void {
    $notices = $container->make( NoticeManager::class );
    $check   = new \MyAddon\Notices\HealthChecks\MyApiCheck( $notices );

    // Also runs on admin page load (once per session, transient-gated).
    $notices->add_health_check( $check );

    // Run on the daily cron so the notice appears even without a site visit.
    add_action(
        'benecaster_license_cron_complete',
        function () use ( $notices, $check ): void {
            $notices->run_health_check( $check );
        }
    );
} );

Notes

For health checks that make outbound HTTP requests, avoid registering with add_health_check() — that runs on every admin page load and adds latency. Attach HTTP-based checks to this hook only (daily cadence). run_health_check() does not set the admin-session transient, so on any day an admin visits a Benecaster page the check will run twice — ensure publish() and delete() on your notice object are idempotent.