Global Filename Template

This snippet puts all files in an entry-specific subfolder and increments the filename with its count.

Requires GP File Renamer v1.0.5+.

Code

Filename: gpfr-global-filename-template.php

<?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 );

Leave a Reply

Your email address will not be published. Required fields are marked *

  • Trouble installing this snippet? See our troubleshooting tips.
  • Need to include code? Create a gist and link to it in your comment.
  • Reporting a bug? Provide a URL where this issue can be recreated.

By commenting, I understand that I may receive emails related to Gravity Wiz and can unsubscribe at any time.