wp_should_handle_php_error

过滤钩子
apply_filters( 'wp_should_handle_php_error', false, $error )
参数
  • (bool) $should_handle_error Whether the error should be handled by the fatal error handler.
    Required:
  • (array) $error Error information retrieved from `error_get_last()`.
    Required:
定义位置
相关勾子
wp_handle_uploadwp_php_error_argswp_should_replace_insecure_home_urlwp_audio_embed_handlerwp_embed_handler_audio
相关方法
wp_show_heic_upload_errorwp_kses_html_errorwp_send_json_errorwp_scheduled_deletewp_import_handle_uploadwp_check_php_version
引入
5.2.0
弃用
-

wp_should_handle_php_error: 这是一个 WordPress 内置的函数,它用于判断是否应该处理 PHP 错误。如果将这个函数的返回值设置为 true,则 WordPress 将处理 PHP 错误;如果设置为 false,则 WordPress 不会处理 PHP 错误。

过滤一个给定的错误是否应该由致命错误处理程序来处理。

这个过滤器只有在错误还没有被配置为由WordPress核心处理时才会被触发。因此,它只允许添加更多的错误处理规则,但不能删除现有的规则。

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

常见问题

FAQs
查看更多 >