# Remove the [Site Name] Prefix From Email Subjects

> Strips the "[Your Site Name]" WordPress puts at the start of its email subjects, which looks dated and wastes space on phones.

- Type: PHP
- Runs: Run everywhere
- Category: [Email](https://wpide.com/library/category/email/)
- Tags: email, subject, cleanup
- Author: WPIDE Team
- Installs: 0
- Updated: 2026-10-28
- Page: https://wpide.com/library/email-remove-subject-site-prefix/

## Code

```php
add_filter( 'wp_mail', function ( $atts ) {
    $prefix = '[' . wp_specialchars_decode( get_option( 'blogname' ), ENT_QUOTES ) . ']';

    if ( 0 === strpos( (string) $atts['subject'], $prefix ) ) {
        $atts['subject'] = ltrim( substr( $atts['subject'], strlen( $prefix ) ) );
    }

    return $atts;
}, 1 );
```

## Notes

Only removes the prefix when it matches your site title exactly.

## How to use it

Install the free WPIDE plugin (https://wordpress.org/plugins/wpide/), find "Remove the [Site Name] Prefix From Email Subjects" in its snippet library and add it in one click; or create a new PHP snippet in WPIDE (or any code snippets plugin) and paste the code above. More snippets: https://wpide.com/library/
