---
title: "Using shortcodes inside Gravity Forms notifications"
date: 2026-04-23
author: "GravityKit"
link: "https://www.gravitykit.com/docs/gravityview/gravity-forms/using-shortcodes-inside-gravity-forms-notifications/"
---

When sending a notification, you may want to have a different email subject line based on the value of a field. In that case, [you can use ](https://www.gravitykit.com/docs/gravityview/shortcodes/gvlogic-shortcode/). Unfortunately, Gravity Forms only processes shortcodes inside a notification's Message field (the email body). It does ***not*** process shortcodes inside other fields, such as the Subject.

To process shortcodes inside other notification fields, we will use Gravity Forms’ [gform\_notification](https://docs.gravityforms.com/gform_notification/) filter. Here's an example of processing shortcodes inside the **To**, **Subject,** and **From Name** fields:

ℹ️ Only run shortcodes that you know contain safe output! Using a shortcode in these fields has the potential to break the Notifications functionality.

```
/**
 * @param array $notification
 */
add_filter( 'gform_notification', function( $notification ) {

	$notification['to']       = do_shortcode( $notification['to'] );
	$notification['subject']  = do_shortcode( $notification['subject'] );
	$notification['fromName'] = do_shortcode( $notification['fromName'] );

	return $notification;
} );
```

```
/**
 * @param array $notification
 */
add_filter( 'gform_notification', function( $notification ) {

	$notification['to']       = do_shortcode( $notification['to'] );
	$notification['subject']  = do_shortcode( $notification['subject'] );
	$notification['fromName'] = do_shortcode( $notification['fromName'] );

	return $notification;
} );
```

Now, you can use shortcodes inside your subject line like this:

```
[gvlogic if="{Industry:3}" is="Automobiles"]🚘 Drive in![else]🚴 Bike in![/gvlogic]
```

```
[gvlogic if="{Industry:3}" is="Automobiles"]🚘 Drive in![else]🚴 Bike in![/gvlogic]
```

![Gravity Forms notification setup using shortcodes and conditional logic in the subject field](https://www.gravitykit.com/wp-content/uploads/2025/10/file-59POaYOh3h.png)