Developers

Fatal Error Notify Pro provides several filters that allow you to customize its behavior. Here’s a comprehensive list of available filters:

Error Handling Filters

fen_ignore_error

Filter whether to ignore an error before sending notifications.

add_filter('fen_ignore_error', function($ignore, $error) {
    // Ignore all warnings from a specific plugin
    if ($error['type'] === E_WARNING && strpos($error['file'], 'my-plugin') !== false) {
        return true;
    }
    return $ignore;
}, 10, 2);

fen_error

Modify the error data before notifications are sent.

add_filter('fen_error', function($error) {
    // Add custom data to error
    $error['custom_data'] = 'Some additional context';
    return $error;
});

fen_is_error_type_enabled

Filter whether an error type is enabled for notifications.

add_filter('fen_is_error_type_enabled', function($enabled, $error, $channel) {
    // Only allow fatal errors for Slack
    if ($channel === 'slack' && $error['type'] !== E_ERROR) {
        return false;
    }
    return $enabled;
}, 10, 3);

fen_is_error_paused

Filter whether error notifications are paused for a specific error.

add_filter('fen_is_error_paused', function($paused, $error) {
    // Pause notifications during development
    if (defined('WP_DEBUG') && WP_DEBUG) {
        return true;
    }
    return $paused;
}, 10, 2);

fen_is_rate_limited

Filter whether an error notification is currently rate limited.

add_filter('fen_is_rate_limited', function($rate_limited, $error) {
    // Custom rate limiting logic
    return $rate_limited;
}, 10, 2);

Notification Filters

fen_email_notification_output

Modify the HTML output of email notifications.

add_filter('fen_email_notification_output', function($output, $error) {
    // Add custom HTML to notification
    $output .= '

Environment: ' . wp_get_environment_type() . '

'; return $output; }, 10, 2);

fen_email_notification_subject

Customize the email notification subject line.

add_filter('fen_email_notification_subject', function($subject, $error) {
    return '[' . wp_get_environment_type() . '] ' . $subject;
}, 10, 2);

fen_slack_notification_data

Modify the data sent to Slack for notifications.

add_filter('fen_slack_notification_data', function($data, $error) {
    // Add custom fields to Slack message
    $data['blocks'][] = [
        'type' => 'context',
        'elements' => [
            [
                'type' => 'mrkdwn',
                'text' => '*Environment*: ' . wp_get_environment_type()
            ]
        ]
    ];
    return $data;
}, 10, 2);


Other Filters

fen_rate_limit_time

Modify the rate limiting duration (default: 1 hour).

add_filter('fen_rate_limit_time', function($time) {
    return 30 * MINUTE_IN_SECONDS; // Set to 30 minutes
});

fen_use_wp_mail

Control whether to use wp_mail() or PHP’s mail() function.

add_filter('fen_use_wp_mail', function($use_wp_mail) {
    return false; // Use PHP mail() instead
});

fen_network_active

Filter whether the plugin should be network active in multisite.

add_filter('fen_network_active', function($network_active) {
    return true; // Force network activation
});

fen_get_setting_license_key

Filter the stored license key value.

add_filter('fen_get_setting_license_key', function($license_key) {
    return defined('FEN_LICENSE_KEY') ? FEN_LICENSE_KEY : $license_key;
});