WordPress tells PHP, using ini_set()
, in wp_debug_mode()
which errors should be handled and which file they should be written to. The function is called in wp-settings.php
when WP is starting up.
As suggested by David in How to catch all PHP errors with custom error handler? answers you could use PHP’s set_error_handler()
to define a custom error handler for sending the errors to somewhere else.
Then there’s the WP_Fatal_Error_Handler which WP attaches to PHP via register_shutdown_function()
with wp_register_fatal_error_handler()
– also in wp-settings.php
.
Apparently the error handler can be extended, which means that you could use a child class to send the errors to the 3rd party service.
A drop-in ‘fatal-error-handler.php’ can be used to override the
instance of this class and use a custom implementation for the fatal
error handler that WordPress registers. The custom class should extend
this class and can override its methods individually as necessary. The
file must return the instance of the class that should be registered.