# Stop Gmail Grouping Your Site's Emails Into Threads

> Adds a unique reference header to every email so Gmail shows each notification separately instead of bundling emails with the same subject into one long conversation.

- Type: PHP
- Runs: Run everywhere
- Category: [Email](https://wpide.com/library/category/email/)
- Tags: email, gmail, headers
- Author: WPIDE Team
- Installs: 0
- Updated: 2026-10-28
- Page: https://wpide.com/library/email-no-gmail-threading/

## Code

```php
add_action( 'phpmailer_init', function ( $phpmailer ) {
    $phpmailer->addCustomHeader( 'X-Entity-Ref-ID', wp_generate_uuid4() );
} );
```

## Notes

Invisible to recipients; Gmail uses the X-Entity-Ref-ID header to decide whether to thread messages.

## How to use it

Install the free WPIDE plugin (https://wordpress.org/plugins/wpide/), find "Stop Gmail Grouping Your Site's Emails Into Threads" 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/
