Using WordPress ‘automatic_updates_send_debug_email’ PHP filter

The automatic_updates_send_updates_send_debug_email WordPress PHP filter determines whether to send a debugging email for each automatic background update. By default, emails are sent if the WordPress installation is a development version.

Usage

add_filter('automatic_updates_send_debug_email', 'your_custom_function', 10, 1);

function your_custom_function($development_version) {
    // your custom code here
    return $development_version;
}

Parameters

  • $development_version (bool) – Determines if emails are sent for development versions. Return false to avoid sending the email.

More information

See WordPress Developer Resources: automatic_updates_send_debug_email

Examples

Disable debugging emails for all automatic updates

Disable sending debugging emails for all automatic background updates, regardless of whether the installation is a development version or not.

add_filter('automatic_updates_send_debug_email', 'disable_debug_emails', 10, 1);

function disable_debug_emails($development_version) {
    return false;
}

Enable debugging emails for all automatic updates

Enable sending debugging emails for all automatic background updates, even if the installation is not a development version.

add_filter('automatic_updates_send_debug_email', 'enable_debug_emails', 10, 1);

function enable_debug_emails($development_version) {
    return true;
}

Send debugging emails only for development versions

Send debugging emails only if the installation is a development version.

add_filter('automatic_updates_send_debug_email', 'send_debug_emails_for_development', 10, 1);

function send_debug_emails_for_development($development_version) {
    return $development_version;
}

Send debugging emails based on a custom condition

Send debugging emails based on a custom condition, such as when a specific plugin is active.

add_filter('automatic_updates_send_debug_email', 'send_debug_emails_custom_condition', 10, 1);

function send_debug_emails_custom_condition($development_version) {
    if (is_plugin_active('your-plugin/your-plugin.php')) {
        return true;
    }
    return $development_version;
}

Send debugging emails only on specific days

Send debugging emails only on specific days of the week, such as Mondays.

add_filter('automatic_updates_send_debug_email', 'send_debug_emails_on_specific_days', 10, 1);

function send_debug_emails_on_specific_days($development_version) {
    $current_day = date('w'); // 0 (Sunday) to 6 (Saturday)

    if ($current_day == 1) { // 1 for Monday
        return true;
    }
    return $development_version;
}