The gform_slack_process_message_shortcodes filter enables shortcode processing in Slack messages for Gravity Forms.
Usage
To apply the filter to all forms:
add_filter('gform_slack_process_message_shortcodes', 'your_function_name', 10, 3);
To target a specific form with form ID 4:
add_filter('gform_slack_process_message_shortcodes_4', 'your_function_name', 10, 3);
Parameters
- $process_shortcodes (boolean): Determines if shortcode processing is enabled. Default is false.
- $form (Form Object): The current form object.
- $feed (Feed Object): The current feed object.
More information
See Gravity Forms Docs: gform_slack_process_message_shortcodes
Examples
Enable shortcode processing for all forms
Enable shortcode processing for all forms using this code:
add_filter('gform_slack_process_message_shortcodes', '__return_true');
Enable shortcode processing for a specific form
Enable shortcode processing for a form with ID 4:
add_filter('gform_slack_process_message_shortcodes_4', '__return_true');
Enable shortcode processing for a specific feed name
Enable shortcode processing only for a feed named “Slack Feed 1”:
add_filter('gform_slack_process_message_shortcodes', function($process_shortcodes, $form, $feed) { return rgars($feed, 'meta/feed_name') == 'Slack Feed 1' ? true : $process_shortcodes; }, 10, 3);
Disable shortcode processing for a specific form
Disable shortcode processing for a form with ID 4:
add_filter('gform_slack_process_message_shortcodes_4', '__return_false');
Enable shortcode processing for forms with a specific title
Enable shortcode processing only for forms with the title “My Special Form”:
add_filter('gform_slack_process_message_shortcodes', function($process_shortcodes, $form, $feed) { return $form['title'] == 'My Special Form' ? true : $process_shortcodes; }, 10, 3);