1. Home
  2. Docs
  3. File Renaming on Upload
  4. How to
  5. Understanding File Renaming Rules

Understanding File Renaming Rules

The File Renaming on Upload plugin by WPFactory goes beyond simple file renaming. It empowers you to define comprehensive renaming rules, ensuring uploaded files have clear and consistent names that enhance organization within your WordPress website. This guide delves into the plugin’s Rules settings, allowing you to explore various options for constructing meaningful filenames.

pasted image 0 113

Accessing Plugin Settings

  • Navigate to Settings: Within your WordPress dashboard, locate the Settings menu on the left-hand side and click on it.
  • Find File Renaming: Look for a section labeled File Renaming (or similar wording based on your plugin version). Click on it to access the plugin’s settings.

Understanding Renaming Rules

Within the plugin’s settings, you’ll likely find a section dedicated to Rules. Here’s a breakdown of the key elements you can use to construct your filename structure.

Basic Components

  • {filename}: Inserts the original filename uploaded by the user.
  • Site URL Rule: Enables you to incorporate your website’s URL into the filename using the {siteurl} rule.

Datetime Rule

  • {datetime}: Includes the current date and time in your chosen format (e.g., {datetime}_YYYY-MM-DD_HH-MM-SS). You can explore various format options provided by the plugin.

Content-Based Rules (Optional)

  • Post title: Utilizes the {posttitle} rule to add the title of the post or page where the file is attached (if applicable).
  • Upload date: Incorporates the date the file was uploaded using the {uploaddate} rule. You can choose a specific date format.

Advanced Data Integration (Optional)

These rules allow you to leverage additional data for more dynamic filenames.

  • Custom string: Enables you to define a static text string to be included in the filename using the {custom_string} rule.
  • Post Slug: Incorporates the post slug (a SEO-friendly URL snippet) using the {postslug} rule (if applicable).

User Data:

  • {userid}: Inserts the current user ID or the media author ID (if available).
  • {userrole}: Includes the current user’s role(s) or the media author’s role (if available).
  • {username}: Adds the current username or the media author’s name (if available).

Product Data (Optional – WooCommerce Integration)

  • {wc_prod_sku}: For WooCommerce stores, this rule retrieves the SKU (Stock Keeping Unit) from a product if the uploaded file is associated with it.

Post Data (Optional)

  • {postid}: Includes the ID of the post where the file is attached (if applicable).

Filename Refinement Options

In addition to defining the structure, the plugin might offer options to further refine your filenames.

  • Convert Characters: Converts special characters to their ASCII replacements for better compatibility.
  • Lowercase: Transforms all filename characters to lowercase for consistency.
  • Post title (Convert to title case): Attempts to convert the filename to a title case format (e.g., “My New File” instead of “my-new-file”).
  • Remove Accents/Transliterator: Eliminates accents or uses transliteration to ensure consistent character representation.
  • Remove Characters: Allows you to specify characters to be removed from the filename.
  • Truncate: Sets a maximum length for the filename to avoid excessively long names.


By exploring the File Renaming on Upload plugin’s Rules settings, you can create a customized approach to renaming uploaded files on your WordPress website. Leveraging the various components and refinement options empowers you to generate filenames that are clear, descriptive, and aligned with your website’s organization and SEO goals.


Rename Media Files on Upload for WordPress