wp_should_handle_php_error filter-hookWP 5.2.0

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.

Usage

add_filter( 'wp_should_handle_php_error', 'wp_kama_should_handle_php_error_filter', 10, 2 );

/**
 * Function for `wp_should_handle_php_error` filter-hook.
 * 
 * @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()`.
 *
 * @return bool
 */
function wp_kama_should_handle_php_error_filter( $should_handle_error, $error ){

	// filter...
	return $should_handle_error;
}
$should_handle_error(true|false)
Whether the error should be handled by the fatal error handler.
$error(array)
Error information retrieved from error_get_last().

Changelog

Since 5.2.0 Introduced.

Where the hook is called

WP_Fatal_Error_Handler::should_handle_error()
wp_should_handle_php_error
wp-includes/class-wp-fatal-error-handler.php 125
return (bool) apply_filters( 'wp_should_handle_php_error', false, $error );

Where the hook is used in WordPress

Usage not found.