The gform_is_asynchronous_notifications_enabled filter enables or disables async (background) processing of notifications in Gravity Forms.
Usage
A generic example of how to use the filter for all forms:
add_filter('gform_is_asynchronous_notifications_enabled', 'your_function_name', 10, 6);
To limit the scope to a specific form, append the form ID to the end of the hook name (format: gform_is_asynchronous_notifications_enabled_FORMID):
add_filter('gform_is_asynchronous_notifications_enabled_5', 'your_function_name', 10, 6);
Parameters
- $is_asynchronous (boolean) – Indicates if async (background) processing of notifications is enabled. Default is
false
. - $event (string) – The event the notifications are to be sent for. Default is
form_submission
. - $notifications_to_send (array) – An array containing the IDs of the notifications to be sent.
- $form (Form Object) – The form currently being processed.
- $entry (Entry Object) – The entry currently being processed.
- $data (array) – An array of data which can be used in the notifications via the generic {object:property} merge tag. Defaults to an empty array.
More information
See Gravity Forms Docs: gform_is_asynchronous_notifications_enabled
Examples
Enable for ALL forms
Enable async (background) processing of notifications for all forms:
add_filter('gform_is_asynchronous_notifications_enabled', '__return_true');
Disable for ALL forms
Disable async (background) processing of notifications for all forms:
add_filter('gform_is_asynchronous_notifications_enabled', '__return_false');
Enable for a specific event
Enable async (background) processing of notifications for all forms, but only for those assigned to the Form is submitted event:
add_filter('gform_is_asynchronous_notifications_enabled', function ($is_asynchronous, $event) { return $event === 'form_submission'; }, 10, 2);
Enable for a specific form
Enable async (background) processing of notifications for a specific form (e.g. form ID 5):
add_filter('gform_is_asynchronous_notifications_enabled_5', '__return_true');
Disable for a specific form
Disable async (background) processing of notifications for a specific form (e.g. form ID 5):
add_filter('gform_is_asynchronous_notifications_enabled_5', '__return_false');