# Add the Entry Number to Gravity Forms Email Subjects

> Prefixes every Gravity Forms notification subject with the form name and entry ID, so you can find, filter and refer to submissions easily.

- Type: PHP
- Runs: Run everywhere
- Category: [Forms](https://wpide.com/library/category/forms/)
- Tags: gravity-forms, notifications, subject
- Author: WPIDE Team
- Installs: 0
- Updated: 2026-10-28
- Page: https://wpide.com/library/gf-subject-entry-reference/

## Code

```php
$wpide_gf_subject_format = '[%1$s #%2$d] ';

add_filter( 'gform_notification', function ( $notification, $form, $entry ) use ( $wpide_gf_subject_format ) {
    $prefix = sprintf( $wpide_gf_subject_format, $form['title'], (int) rgar( $entry, 'id' ) );

    if ( 0 !== strpos( (string) rgar( $notification, 'subject' ), $prefix ) ) {
        $notification['subject'] = $prefix . rgar( $notification, 'subject' );
    }

    return $notification;
}, 10, 3 );
```

## Notes

Change the format at the top; %1$s is the form title and %2$d the entry ID.

## How to use it

Install the free WPIDE plugin (https://wordpress.org/plugins/wpide/), find "Add the Entry Number to Gravity Forms 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/
