gpfr_filename
Description
Filter the renamed filename.
Usage
Apply to all fields and forms.
add_filter( 'gpfr_filename', 'my_custom_function', 10, 3 );Apply to all fields on a specific form.
add_filter( 'gpfr_filename_FORMID', 'my_custom_function', 10, 3 );Apply to a specific field on a specific form.
add_filter( 'gpfr_filename_FORMID_FIELDID', 'my_custom_function', 10, 3 );Parameters
renamed_file string
Renamed filename.
file string
The original filename.
entry array
The properties of the entry including field values.
form array
The current form.
field \GF_Field
The current field.
Examples
Global Filename Template
<?php
/**
* Gravity Perks // File Renamer // Global Filename Template
* https://gravitywiz.com/documentation/gravity-forms-file-renamer/
*
* This snippet puts all files in an entry-specific subfolder and increments the filename with its count.
*
* Requires GP File Renamer v1.0.5+.
*/
add_filter( 'gpfr_filename_template', function ( $template, $filename, $form, $field, $entry ) {
return '{entry:id}/{filename}-{i}';
}, 10, 5 );Lowercase All Filenames
Since
This filter is available since Gravity Forms File Renamer 1.0.
The $form and $field parameters were added in File Renamer 1.0.5.