diff --git a/classes/abstracts/ActionScheduler_Abstract_QueueRunner.php b/classes/abstracts/ActionScheduler_Abstract_QueueRunner.php index 1b51c301..64ab1eb5 100644 --- a/classes/abstracts/ActionScheduler_Abstract_QueueRunner.php +++ b/classes/abstracts/ActionScheduler_Abstract_QueueRunner.php @@ -78,6 +78,7 @@ function ( $type, $message ) { }, E_USER_ERROR | E_RECOVERABLE_ERROR ); + add_action( 'shutdown', 'restore_error_handler', -10, 0 ); /* * The nested try/catch structure is required because we potentially need to convert thrown errors into @@ -112,6 +113,7 @@ function ( $type, $message ) { $this->handle_action_error( $action_id, $e, $context, $valid_action ); } finally { restore_error_handler(); + remove_action( 'shutdown', 'restore_error_handler', -10 ); } if ( isset( $action ) && is_a( $action, 'ActionScheduler_Action' ) && $action->get_schedule()->is_recurring() ) {