---
title: Understanding File Renaming Rules
description: "WordPress file renaming rules explained: the tokens you can use in filenames and how to format the date and time."
url: "https://wpfactory.com/docs/file-renaming-rule-guide/"
updated: "2026-09-27"
category: How to
tags:
  - File Renaming on Upload
---

# Understanding File Renaming Rules

[Rename Media Files: Improve Your WordPress SEO](https://wpfactory.com/item/file-renaming-on-upload-wordpress-plugin/) builds each new filename from tokens you enable on the Rules tab. Each rule you turn on makes a `{token}` available to place in your filename structure. This guide explains the tokens, which are free and which are Pro, and how to format the datetime output correctly.

![The Rules tab in the Rename Media Files plugin](https://wpfactory.com/wp-content/uploads/pasted-image-0-113-1024x468.png)

### Where the settings live

Go to **WPFactory > File Renaming** in your WordPress admin. The settings page is titled **File Renaming on Upload**. Open the **Rules** tab, enable the rules you want, then reference their tokens in the `filename_structure` field on the General Settings tab.

### Available tokens

| Rule | Token | Option ID | Default | Free/Pro |
| --- | --- | --- | --- | --- |
| Filename | `{filename}` | `filename` | On | Free |
| Site URL | `{siteurl}` | `siteurl` | On | Free |
| Post title | `{posttitle}` | `posttitle` | On | Free |
| Datetime | `{datetime}` | `datetime` | Off | Free |
| Upload date | `{uploaddate}` | `uploaddate` | Off | Pro |
| Custom string | `{custom_string}` | `custom_string` | Off | Pro |
| Post Slug | `{postslug}` | `postslug` | Off | Pro |
| Post ID | `{postid}` | `postid` | Off | Pro |
| User ID | `{userid}` | `userid` | Off | Pro |
| User Role | `{userrole}` | `userrole` | Off | Pro |
| Username | `{username}` | `username` | Off | Pro |
| Product SKU (WooCommerce) | `{wc_prod_sku}` | `wc_prod_sku` | Off | Pro |

### Formatting the datetime output

The Datetime rule accepts a PHP `date()` format string in its `datetime_format` field. The default is `Y-m-d_H-i-s_u`, which produces output such as `2026-07-21_14-30-05_123456` (year, month, day, hour, minute, second, microseconds). Use standard PHP date characters here, not literal placeholders like YYYY or HH.

### {uploaddate} vs {datetime}

These two tokens look similar but capture different moments. `{datetime}` uses the time the renaming rule runs. `{uploaddate}` uses the time the file was originally uploaded. If you rename existing media later, `{datetime}` reflects the moment of that rename while `{uploaddate}` stays fixed to the original upload. The Upload date rule has its own `uploaddate_format` field, defaulting to `Y-m-d_H-i-s`.

### Refining filenames

The Filename rule includes conversion options (`convert`): convert special characters to ASCII replacements, force lowercase, and remove accents or specific characters. The Post title rule includes `use_filename_on_empty_title` (on by default), the fallback that keeps filenames from coming out blank when a post has no title.

### Get more control

The core renaming rules are free. [Rename Media Files: Improve Your WordPress SEO](https://wpfactory.com/item/file-renaming-on-upload-wordpress-plugin/) Pro adds manual filename and permalink editing, bulk renaming of existing media, automatic ALT text and titles, custom field, taxonomy and SKU rules, and more. [See what Pro unlocks](https://wpfactory.com/item/file-renaming-on-upload-wordpress-plugin/).

Related articles

- [How to Create a Custom File Renaming Rule](https://wpfactory.com/docs/create-custom-file-renaming-rule/)
- [Monitoring Background Processes in File Renaming on Upload Plugin](https://wpfactory.com/docs/background-process-monitoring/)
- [Advanced Options for File Renaming in WordPress](https://wpfactory.com/docs/advanced-file-renaming/)
- [Advanced Options in the File Renaming on Upload Plugin](https://wpfactory.com/docs/advanced-renaming-options/)
- [Configuring the File Renaming on Upload Plugin](https://wpfactory.com/docs/file-renaming-plugin/)

 

[![Rename Media Files on Upload for WordPress](https://wpfactory.com/wp-content/uploads/File-Renaming-on-Upload.webp)](https://wpfactory.com/item/file-renaming-on-upload-wordpress-plugin/)
