gravitysmtp_managed_email_types

Description

The gravitysmtp_managed_email_types allows developers to modify or extend the list of managed email types by adding their own custom types.

Usage

add_filter( 'gravitysmtp_managed_email_types', 'your_function_name', 10, 1 );

Parameters

The $email_types array consists of values for the following components.

ComponentsDescription
keyIt should be a unique slug for this email type. The slug doesn’t have any specific requirements except that it must be unique amongst the registered email types.
labelA short, descriptive label for this email type that will be displayed on the Email Management screen.
categoryA human-readable string that defines which category this email type belongs to. The category value is a group header within the Email Management screen.
descriptionA string of detailed information about what this email type is, the recipient(s), and which actions trigger the email. The description is displayed under the email label on the Email Management screen.
disable_callbackMust be a callable method. This is the method that is fired when this email is blocked. The callback should be whatever functionality is required to effectively stop the email from sending. Note: For WordPress Core emails, this is typically done by removing an action or returning false on a filter. The actual callback will vary based on the email type being handled.

Examples

Defines a new email type and adds it to the $email_types array.

add_filter('gravitysmtp_managed_email_types', 'add_custom_email_types');

function add_custom_email_types($email_types) {
    $email_types[] = array(
        'key'              => 'site_admin_email_address_is_changed',
        'label'            => __( 'Site Admin Email Changed', 'gravitysmtp' ),
        'category'         => __( 'Admin', 'gravitysmtp' ),
        'description'      => __( 'Sent to the old Site Admin email address when the Administration Email Address change has been confirmed.', 'gravitysmtp' ),
        'disable_callback' => function () {
            add_filter( 'send_site_admin_email_change_email', '__return_false' );
        },
    );

    // Add more custom email types as needed

    return $email_types;
}

Since

This filter was added in Gravity SMTP 1.3

Source Code

This filter is located in class Email_Stopper in /class-email-stopper.php.