Skip to content

Instantly share code, notes, and snippets.

@danielmcclure
Created November 20, 2018 01:09
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save danielmcclure/f75e9d72cb1dced3b7705399b83670eb to your computer and use it in GitHub Desktop.
Save danielmcclure/f75e9d72cb1dced3b7705399b83670eb to your computer and use it in GitHub Desktop.
Selectively Send Gravity Forms Notifications in Plain Text
<?php
// Send Gravity Form notifications in plain text when Notification is called `Plain Text Notification`
add_filter( 'gform_notification', 'change_notification_format', 10, 3 );
function change_notification_format( $notification, $form, $entry ) {
GFCommon::log_debug( 'gform_notification: change_notification_format() running.' );
// Do the thing only for a notification with the name `Plain Text Notification`
if ( $notification['name'] == 'Plain Text Notification' ) {
GFCommon::log_debug( 'gform_notification: format changed to text.' );
// Change notification format to text from the default html
$notification['message_format'] = 'text';
}
return $notification;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment