Description
This filter can be used to prevent shortcodes used in the post custom field or post title field templates from being processed.
Usage
Applies to all forms:
add_filter( 'gform_process_template_shortcodes_pre_create_post', 'your_function_name', 10, 3 );
Applies to a specific form:
add_filter( 'gform_process_template_shortcodes_pre_create_post_5', 'your_function_name', 10, 3 );
Parameters
- $process_template_shortcodes boolean
Is shortcode processing enabled? Default is false for the post content or true in other areas.
-
$field_type string
The field type currently being processed. Possible values: post_custom_field, post_content, or post_title.
-
$post_data array
The post data prepared from the current entry.
-
$form Form Object
The current form object.
-
$feed Feed Object
The current feed object.
Examples
1. Enable for all forms
This example shows how you can enable shortcode processing for all forms.
add_filter( 'gform_process_template_shortcodes_pre_create_post', '__return_true' );
2. Disable for a specific form
add_filter( 'gform_process_template_shortcodes_pre_create_post_5', '__return_false' );
Placement
This code should be placed in the functions.php file of your active theme.
Source Code
$process_template_shortcodes = apply_filters( 'gform_process_template_shortcodes_pre_create_post', $process_template_shortcodes, $field_type, $post_data, $form, $entry );
This filter is located in GFFormsModel::process_post_template() in forms_model.php.
Since
This filter was added in Gravity Forms 2.0.0.4.