The gform_postimage_description Gravity Forms filter allows you to modify the label of the Post Image Description field.
Usage
Apply the filter to all forms:
add_filter('gform_postimage_description', 'your_function_name', 10, 2);
Target a specific form by appending the form ID to the hook name (format: gform_postimage_description_FORMID):
add_filter('gform_postimage_description_5', 'your_function_name', 10, 2);
Parameters
- $label (string) – The label to be filtered.
- $form_id (integer) – The current form’s ID.
More information
See Gravity Forms Docs: gform_postimage_description
Examples
Change the default Post Image Description label
This example modifies the default label for the Post Image Description field:
add_filter('gform_postimage_description', 'change_postimage_description', 10, 2); function change_postimage_description($label, $form_id) { return 'Image Description'; }
Change the Post Image Description label for a specific form
This example modifies the label for the Post Image Description field only on form with ID 3:
add_filter('gform_postimage_description_3', 'change_postimage_description_for_form_3', 10, 2); function change_postimage_description_for_form_3($label, $form_id) { return 'Custom Image Description'; }
Conditionally change Post Image Description label
This example changes the label based on the form ID:
add_filter('gform_postimage_description', 'conditional_postimage_description', 10, 2); function conditional_postimage_description($label, $form_id) { if ($form_id == 1) { return 'Form 1 Image Description'; } elseif ($form_id == 2) { return 'Form 2 Image Description'; } else { return $label; } }
Add a prefix to the Post Image Description label
This example adds a prefix to the label:
add_filter('gform_postimage_description', 'prefix_postimage_description', 10, 2); function prefix_postimage_description($label, $form_id) { return 'Prefix: ' . $label; }
Add a suffix to the Post Image Description label
This example adds a suffix to the label:
add_filter('gform_postimage_description', 'suffix_postimage_description', 10, 2); function suffix_postimage_description($label, $form_id) { return $label . ' - Suffix'; }