Test Mode for Email Notifications

I was just needing this the other day. Here’s a snippet that should work for enabling a notification test mode. You can then toggle the $intercept variable.

add_filter( 'gform_notification', function( $notification, $form, $entry ) {

	$intercept = true;

	if ( $intercept ) {
		$notification['to'] = 'email@example.com';
	}

	return $notification;

}, 10, 3 );
1 Like