wp_should_handle_php_error
Filter HookDescription
Filters whether a given thrown error should be handled by the fatal error handler. 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.Hook Information
File Location |
wp-includes/class-wp-fatal-error-handler.php
View on GitHub
|
Hook Type | Filter |
Line Number | 125 |
Hook Parameters
Type | Name | Description |
---|---|---|
bool
|
$should_handle_error
|
Whether the error should be handled by the fatal error handler. |
array
|
$error
|
Error information retrieved from `error_get_last()`. |
Usage Examples
Basic Usage
<?php
// Hook into wp_should_handle_php_error
add_filter('wp_should_handle_php_error', 'my_custom_filter', 10, 2);
function my_custom_filter($should_handle_error, $error) {
// Your custom filtering logic here
return $should_handle_error;
}
Source Code Context
wp-includes/class-wp-fatal-error-handler.php:125
- How this hook is used in WordPress core
<?php
120 * @since 5.2.0
121 *
122 * @param bool $should_handle_error Whether the error should be handled by the fatal error handler.
123 * @param array $error Error information retrieved from `error_get_last()`.
124 */
125 return (bool) apply_filters( 'wp_should_handle_php_error', false, $error );
126 }
127
128 /**
129 * Displays the PHP error template and sends the HTTP status code, typically 500.
130 *
PHP Documentation
<?php
/**
* Filters whether a given thrown error should be handled by the fatal error handler.
*
* 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.
*
* @since 5.2.0
*
* @param bool $should_handle_error Whether the error should be handled by the fatal error handler.
* @param array $error Error information retrieved from `error_get_last()`.
*/
Quick Info
- Hook Type: Filter
- Parameters: 2
- File: wp-includes/class-wp-fatal-error-handler.php
Related Hooks
Related hooks will be displayed here in future updates.