Plugin Planet

Premium WordPress Plugins

Announcing a new extension for USP Pro: Custom File Names! This extension automatically names uploaded files with a unique custom prefix, which may be customized directly in the source code. No configuration required, simply install, activate, and enjoy custom/unique file names for all submitted images and files.

How it works

By default, USP Pro uploads files and names them using WordPress default protocols. This works fine for most use-case scenarios, but in some cases you may need to ensure that all files are named in a specific way. That’s where the Custom File Name extension comes into play: it enables you to customize the file name with a unique/custom prefix.

Ways to customize the file name

By default with USP Pro, there are two ways to configure names for submitted files:

  • Default file names: keeps the file name as-is, using WP core functionality
  • Prefix names with a date-based + random string: this can be enabled via the “USP Uploads” setting, “Unique File Names”

So if one of those options works for you, then you’re good to go without the Custom File Names extension. But if you need more control over how the files are named, the extension will enable you to customize the names however is required.

Technical details

When the “Unique File Names” option is enabled in the USP Uploads settings, the following code is used to prefix all submitted file names:

$usp_files['name'][$i] = date('Y-m-d') . '_' . uniqid() . '_' . $usp_files['name'][$i];

As you can see, this prepends the file name with the current date, plus a unique string. So if you need more control over the file names, the Custom File Names extension makes it possible. By default, the extension simply prefixes the file name with a unique ID:

$custom = uniqid();

But this can be changed to whatever is required, directly in the plugin source code. So the extension gives you much control, and enables you to set file names using any criteria that is available to WordPress. If you decide to purchase the extension, we will be glad to help you modify the code to suit your needs. Contact us for more information.

Get the extension!

Buy Custom File Names

Check out more extensions »