gpfr_filename_template

  1. Description
  2. Usage
  3. Parameters
  4. Example
  5. Since

Description

Modify the filename template for a given file.

This allows you to change the final name of the file and use merge tags to do so.

Usage

add_filter( 'gpfr_filename_template', 'my_custom_function' );

Parameters

  • template mixed

    The filename template.

  • file string

    The original file name.

  • form array

    The current form being processed.

  • field array

    The field that the file belongs to.

  • entry array

    The entry that the file belongs to.

Example

Save each uploaded file in a folder whose name is the associated entry id.

add_filter( 'gpfr_filename_template', function ( $template, $filename, $form, $field, $entry ) {
	return '{entry:id}/{filename}-{i}';
}, 10, 5 );

Since

This action is available since Gravity Forms File Renamer 1.0.6