Year Merge Tag in Email Notifications

Hi all,

I know that the ability to display the current ddmmyy and mmddyy in email notifications via the merge field {date_mdy} & {date_dmy}.

But is there any way to only display the year? I would like to use it for the copyright in the footer… but would not like to have to update this every year on all of my client sites.

Thanks.

There is no merge tag for year only. However, you can get the year using a WordPress or a PHP function.

You want to show the year in the copyright in the footer of your email notification, is that correct? If so, you can do this to automatically add the copyright notice with current year to all your notifications site-wide:

add_filter( 'gform_notification', 'add_copyright_year', 10, 3 );
function add_copyright_year( $notification, $form, $entry ) {
	// https://codex.wordpress.org/Function_Reference/current_time
	$year = current_time('Y');
	// append to notification message
	$notification['message'] .= "Copyright © " . $year;
	return $notification;
}

You can add that code to your theme functions.php file or a custom functionality plugin if you are using one. Let us know if you have any questions about that.