WP_Fatal_Error_Handler::handle() WordPress Method
The WP_Fatal_Error_Handler::handle() method is used to set up the error handling for a fatal error. It sets up the error_handler and register_shutdown_function for a fatal error.
WP_Fatal_Error_Handler::handle() #
Runs the shutdown handler.
Description
This method is registered via register_shutdown_function()
.
Source
File: wp-includes/class-wp-fatal-error-handler.php
public function handle() { if ( defined( 'WP_SANDBOX_SCRAPING' ) && WP_SANDBOX_SCRAPING ) { return; } // Do not trigger the fatal error handler while updates are being installed. if ( wp_is_maintenance_mode() ) { return; } try { // Bail if no error found. $error = $this->detect_error(); if ( ! $error ) { return; } if ( ! isset( $GLOBALS['wp_locale'] ) && function_exists( 'load_default_textdomain' ) ) { load_default_textdomain(); } $handled = false; if ( ! is_multisite() && wp_recovery_mode()->is_initialized() ) { $handled = wp_recovery_mode()->handle_error( $error ); } // Display the PHP error template if headers not sent. if ( is_admin() || ! headers_sent() ) { $this->display_error_template( $error, $handled ); } } catch ( Exception $e ) { // Catch exceptions and remain silent. } }
Expand full source codeCollapse full source codeView on TracView on GitHub
Changelog
Version | Description |
---|---|
5.2.0 | Introduced. |