wp_should_handle_php_error хук-фильтрWP 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.

Использование

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(массив)
Error information retrieved from error_get_last().

Список изменений

С версии 5.2.0 Введена.

Где вызывается хук

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

Где используется хук в WordPress

Использование не найдено.