WordPress at Your Fingertips
function is not described

WP_Fatal_Error_Handler::detect_error() protected WP 5.2.0

Detects the error causing the crash if it should be handled.

{} It's a method of the class: WP_Fatal_Error_Handler{}

No Hooks.


Array|null. Error that was triggered, or null if no error received or if the error should not be handled.


// protected - for code of main (parent) or child class
$result = $this->detect_error();

Code of WP_Fatal_Error_Handler::detect_error() WP 5.8.3

protected function detect_error() {
	$error = error_get_last();

	// No error, just skip the error handling code.
	if ( null === $error ) {
		return null;

	// Bail if this error should not be handled.
	if ( ! $this->should_handle_error( $error ) ) {
		return null;

	return $error;