Description

The wpforms_emails_templates_general_set_initial_args filter lets you adjust the General email template settings before an email is rendered and sent. You can modify header, body, footer, and style values, including removing the header image for specific forms.

Use this filter to tailor the email template based on context such as form ID or processing state. For example, you can remove the header image for selected forms or adjust the email title.

parametertypedescription
$argsarrayEmail template arguments. Includes header, body, footer, style. When not sending plain text, header['header_image'] is available.
$templateobjectThe General template instance (\WPForms\Emails\Templates\General).

Source

wpforms/src/Emails/Templates/General.php

Example

/**
 * Remove the header image for specific forms.
 */
function wpf_dev_email_template_args( $args, $template ) {
    $targets = array( 123, 456 ); // Replace with your form IDs.

    if ( ! empty( $_POST['wpforms']['id'] ) && in_array( (int) $_POST['wpforms']['id'], $targets, true ) ) {
        unset( $args['header']['header_image'] );
    }

    return $args;
}
add_filter( 'wpforms_emails_templates_general_set_initial_args', 'wpf_dev_email_template_args', 10, 2 );

Reference Article