[Documentation](https://groundhogg.io/documentation/) » [Filter Hooks](https://groundhogg.io/documentation/#doc-filter-hooks)

# groundhogg/email/subject

Published Wednesday, June 10, 2026 · Last updated Wednesday, June 10, 2026

Filters the subject line of an email just before it is sent, after merge tags have been processed.

```

apply_filters( 'groundhogg/email/subject', $subject, $email, $contact );
```

You will receive the processed subject string, the `Email` object, and the recipient `Contact` object.

## Example

```

add_filter( 'groundhogg/email/subject', 'my_extension_personalise_subject', 10, 3 );

/**
 * Prepend the contact's company name to the subject for B2B sends.
 *
 * @param string               $subject
 * @param \Groundhogg\Email   $email
 * @param \Groundhogg\Contact $contact
 *
 * @return string
 */
function my_extension_personalise_subject( $subject, $email, $contact ) {
    $company = $contact->get_company();

    if ( $company ) {
        return '[' . $company . '] ' . $subject;
    }

    return $subject;
}
```
