开发者 | verygoodplugins |
---|---|
更新时间 | 2024年1月12日 19:11 |
PHP版本: | 4.6 及以上 |
WordPress版本: | 6.5.0 |
版权: | GPLv2 or later |
版权网址: | 版权信息 |
/wp-content/plugins/fatal-error-notify
directory.
Or: Install the plugin through the WordPress plugins screen directly.
Then:
Fatal Error Notify hooks into PHP's "shutdown" function to send notifications right before the page stops loading. Even the dreaded "500 - Internal Server Error" still triggers PHP's shutdown actions. Even if your site is completely offline, in most cases this plugin will be able to detect the error and notify you.
Fatal Error Notify Pro includes several additional features, like Slack notifications, the ability to hide the plugin settings, multisite support, logging of recorded errors, out of memory handling, the ability to pause individual notifications, and more. Fatal Error Notify Pro also includes integrations with Gravity Forms, WooCommerce, WPForms, WP Fusion, and WP Mail SMTP and can send notifications when errors are logged in those plugins.
Yes, you can use the filter fen_ingore_error
, like so:
function fen_ignore_error( $ignore, $error ) {
if( $error['file'] == '/home/username/public_html/wp-includes/class-phpass.php' ) {
$ignore = true;
}
return $ignore;
}
add_filter( 'fen_ignore_error', 'fen_ignore_error', 10, 2 );
The $error
variable is an array containing:
$error['type']
: (int) The PHP error code$error['message']
: (string) The error message$error['file']
: (string) The path to the file that triggered the error$error['line']
: (int) The line number that triggered the errorYup, you bet! You can update the plugin settings using WP CLI, for example to set a default list of error levels, or a notification email address.
The two methods are get_option
and update_option
. For example:
wp fatal-error-notify get_option slack_notifications
Will tell you if Slack notifications are enabled on the site.
wp fatal-error-notify update_option notification_email email@domain.com
Will update the notification email for the site.
You can also update options on multiple sites using xargs:
wp site list --field=url | xargs -n1 -I {} sh -c 'wp --url={} fatal-error-notify update_option notification_email email@domain.com'
If you are updating options that are stored as arrays (for example levels
or plugins
) you can use JSON-formatted values. For an example, use get_option
first on the field you are trying to update.
WARNING
level errors in v1.4.6shutdown
action priority 1, to fix cases where other plugins generate notices or warnings during shutdown
after a fatal errorunlink
warnings still triggering notifications if unlink
was the first part of the error string