The gform_advancedpostcreation_excerpt filter allows you to control the availability of the post excerpt field in the feed settings.
Usage
add_filter('gform_advancedpostcreation_excerpt', 'your_function_name', 10, 1);
Parameters
- $enable_excerpt (bool): Determines whether the Post Excerpt setting is available. The default value is false.
More information
See Gravity Forms Docs: gform_advancedpostcreation_excerpt
Examples
Enable Post Excerpt Setting
Enable the Post Excerpt setting in the feed settings.
add_filter('gform_advancedpostcreation_excerpt', 'enable_excerpt', 10, 1); function enable_excerpt($enable_excerpt) { return true; }
Disable Post Excerpt Setting
Disable the Post Excerpt setting in the feed settings.
add_filter('gform_advancedpostcreation_excerpt', 'disable_excerpt', 10, 1); function disable_excerpt($enable_excerpt) { return false; }
Enable Post Excerpt for Specific Form
Enable the Post Excerpt setting only for a specific form by its ID.
add_filter('gform_advancedpostcreation_excerpt', 'enable_excerpt_for_specific_form', 10, 2); function enable_excerpt_for_specific_form($enable_excerpt, $form_id) { if ($form_id == 5) { return true; } return $enable_excerpt; }
Enable Post Excerpt Based on User Role
Enable the Post Excerpt setting for users with the ‘editor’ role.
add_filter('gform_advancedpostcreation_excerpt', 'enable_excerpt_for_editors', 10, 1); function enable_excerpt_for_editors($enable_excerpt) { if (current_user_can('editor')) { return true; } return $enable_excerpt; }
Toggle Post Excerpt Based on Custom Condition
Toggle the Post Excerpt setting based on a custom condition.
add_filter('gform_advancedpostcreation_excerpt', 'toggle_excerpt_based_on_condition', 10, 1); function toggle_excerpt_based_on_condition($enable_excerpt) { // Replace 'your_custom_condition()' with your actual custom condition if (your_custom_condition()) { return true; } else { return false; } }