Action Scheduler Handler
<?php
use DeepWebSolutions\Framework\Utilities\CronEvents\CronEventsService;
use DeepWebSolutions\Framework\Utilities\CronEvents\Handlers\ActionSchedulerCronEventsHandler;
$as_handler = new ActionSchedulerCronEventsHandler( 'my-handler-id' );
// you can register the handler in the constructor...
$cron_service = new CronEventsService( $my_plugin, $my_logging_service, $my_hooks_service, array( $as_handler ) );
// ...or alternatively you can also do this
$cron_service->register_handler( $as_handler );
// now to use it ... if you set your handler's ID to 'default', you can skip the last argument
$cron_service->schedule_single_event( 'my-hook', null, array(), 'my-handler-id' );
Last updated