Title: wp_should_handle_php_error
Published: May 7, 2019
Last modified: May 20, 2026

---

# apply_filters( ‘wp_should_handle_php_error’, bool $should_handle_error, array $error )

## In this article

 * [Description](https://developer.wordpress.org/reference/hooks/wp_should_handle_php_error/?output_format=md#description)
 * [Parameters](https://developer.wordpress.org/reference/hooks/wp_should_handle_php_error/?output_format=md#parameters)
 * [Source](https://developer.wordpress.org/reference/hooks/wp_should_handle_php_error/?output_format=md#source)
 * [Related](https://developer.wordpress.org/reference/hooks/wp_should_handle_php_error/?output_format=md#related)
 * [Changelog](https://developer.wordpress.org/reference/hooks/wp_should_handle_php_error/?output_format=md#changelog)

[ Back to top](https://developer.wordpress.org/reference/hooks/wp_should_handle_php_error/?output_format=md#wp--skip-link--target)

Filters whether a given thrown error should be handled by the fatal error handler.

## 󠀁[Description](https://developer.wordpress.org/reference/hooks/wp_should_handle_php_error/?output_format=md#description)󠁿

This filter is only fired if the error is not already configured to be handled by
WordPress core. As such, it exclusively allows adding further rules for which errors
should be handled, but not removing existing ones.

## 󠀁[Parameters](https://developer.wordpress.org/reference/hooks/wp_should_handle_php_error/?output_format=md#parameters)󠁿

 `$should_handle_error`bool

Whether the error should be handled by the fatal error handler.

`$error`array

Error information retrieved from `error_get_last()`.

## 󠀁[Source](https://developer.wordpress.org/reference/hooks/wp_should_handle_php_error/?output_format=md#source)󠁿

    ```php
    return (bool) apply_filters( 'wp_should_handle_php_error', false, $error );
    ```

[View all references](https://developer.wordpress.org/reference/files/wp-includes/class-wp-fatal-error-handler.php/)
[View on Trac](https://core.trac.wordpress.org/browser/tags/7.0/src/wp-includes/class-wp-fatal-error-handler.php#L125)
[View on GitHub](https://github.com/WordPress/wordpress-develop/blob/7.0/src/wp-includes/class-wp-fatal-error-handler.php#L125-L125)

## 󠀁[Related](https://developer.wordpress.org/reference/hooks/wp_should_handle_php_error/?output_format=md#related)󠁿

| Used by | Description | 
| [WP_Fatal_Error_Handler::should_handle_error()](https://developer.wordpress.org/reference/classes/wp_fatal_error_handler/should_handle_error/)`wp-includes/class-wp-fatal-error-handler.php` |

Determines whether we are dealing with an error that WordPress should handle in order to protect the admin backend against WSODs.

  |

## 󠀁[Changelog](https://developer.wordpress.org/reference/hooks/wp_should_handle_php_error/?output_format=md#changelog)󠁿

| Version | Description | 
| [5.2.0](https://developer.wordpress.org/reference/since/5.2.0/) | Introduced. |

## User Contributed Notes

You must [log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fhooks%2Fwp_should_handle_php_error%2F)
before being able to contribute a note or feedback.