| CARVIEW |
Select Language
HTTP/2 301
date: Mon, 29 Dec 2025 02:14:01 GMT
content-type: text/html; charset=UTF-8
location: https://docs.gravityforms.com/gform_field_types_delete_files/
server: cloudflare
strict-transport-security: max-age=604800
strict-transport-security: max-age=31536000; includeSubDomains
x-content-type-options: nosniff
x-content-type-options: nosniff
x-xss-protection: 1; mode=block
x-xss-protection: 1; mode=block
x-frame-options: SAMEORIGIN
x-frame-options: SAMEORIGIN
content-security-policy: frame-ancestors 'self';
referrer-policy: no-referrer
referrer-policy: strict-origin-when-cross-origin
x-redirect-by: WordPress
fastcgi-cache: EXPIRED
cf-cache-status: DYNAMIC
nel: {"report_to":"cf-nel","success_fraction":0.0,"max_age":604800}
report-to: {"group":"cf-nel","max_age":604800,"endpoints":[{"url":"https://a.nel.cloudflare.com/report/v4?s=PJ1h0acG1JkvZLNZUPISK%2BBS3z9pfJ%2BkUEwlPUkt2F3aPGezgP64olnrZ5JE6qtCQZpQ3ivTfVVQnjIfYfmGLi7CUlv7WdfzgJxmI1ygMb19hbZm"}]}
cf-ray: 9b55c80a2b1f8a2a-BLR
HTTP/2 200
date: Mon, 29 Dec 2025 02:14:01 GMT
content-type: text/html; charset=UTF-8
server: cloudflare
vary: Accept-Encoding
strict-transport-security: max-age=604800
strict-transport-security: max-age=31536000; includeSubDomains
x-content-type-options: nosniff
x-content-type-options: nosniff
x-xss-protection: 1; mode=block
x-xss-protection: 1; mode=block
x-frame-options: SAMEORIGIN
x-frame-options: SAMEORIGIN
content-security-policy: frame-ancestors 'self';
referrer-policy: no-referrer
referrer-policy: strict-origin-when-cross-origin
link: ; rel="https://api.w.org/"
link: ; rel="alternate"; title="JSON"; type="application/json"
link: ; rel=shortlink
fastcgi-cache: HIT
report-to: {"group":"cf-nel","max_age":604800,"endpoints":[{"url":"https://a.nel.cloudflare.com/report/v4?s=l%2BUVmbKbH3OHl7x5hvMVzI1LzrpHsXB0WCfVGPaSVo%2Fr3WdgeEhUtWRssTES7lsF5WV3dZJ%2F3YahbOnUO9L%2FYyhklvW2w%2B%2Bc%2FjWLmIF%2BkUqqlMY%2F"}]}
cf-cache-status: DYNAMIC
nel: {"report_to":"cf-nel","success_fraction":0.0,"max_age":604800}
content-encoding: gzip
cf-ray: 9b55c810d9a38a2a-BLR
gform_field_types_delete_files - Gravity Forms Documentation
gform_field_types_delete_files
Description
Allows additional files to be deleted when file deletion occurs by adding additional field types.
Usage
The following would apply to all forms.
add_filter( 'gform_field_types_delete_files', 'your_function_name', 10, 2 );
To target a specific form, append the form id to the hook name. (format: gform_field_types_delete_files_FORMID)
add_filter( 'gform_field_types_delete_files_1', 'your_function_name', 10, 2 );
Parameters
- $field_types array
Field types which contain file uploads.
-
$form Form Object
The current form.
Examples
The following example will allow you to keep files associated to entries after deleting the entries.
add_filter( 'gform_field_types_delete_files', '__return_empty_array' );
The following example adds the post_custom_field to the field types to be removed.
add_filter( 'gform_field_types_delete_files', 'delete_custom_field_upload' );
function delete_custom_field_upload( $field_types ) {
$field_types[] = 'post_custom_field';
return $field_types;
}
Placement
This code should be placed in the functions.php file of your active theme.
Since
This filter was added in Gravity Forms version 1.9.10.
Source Code
This filter is located in:
- GFFormsModel::get_delete_file_field_types() in forms_model.php
- GFFormsModel::get_delete_file_field_types() in forms_model_legacy.php