The filename structure placeholders are the {tokens} that decide how Rename Media Files: Improve Your WordPress SEO builds each uploaded file’s name. You place tokens in the Filename structure field (default {siteurl}{posttitle}{filename}) under WPFactory > File Renaming > General Settings, and you switch each token on under the Rules tab. This page lists every token, whether it is free or Pro, and what it inserts.
How tokens work #
A token only takes effect when its matching rule is enabled on the Rules tab. Tokens are joined by the character set in Character(s) used to separate rules (filename_structure_chars_between, default -), and the finished name is capped at Max length (filename_structure_max_length, default 200).
Available placeholders #
| Token | Rule (Option ID) | Inserts | Free/Pro |
|---|---|---|---|
{filename} |
filename |
The original uploaded filename. | Free |
{siteurl} |
siteurl |
Your site URL (editable text). | Free |
{posttitle} |
posttitle |
Title of the post the file is attached to. | Free |
{datetime} |
datetime |
The date and time the rule runs, in a PHP date() format (default Y-m-d_H-i-s_u). |
Free |
{uploaddate} |
uploaddate |
The file’s upload date (default format Y-m-d_H-i-s). Unlike {datetime}, this is the upload time, not the run time. |
Pro |
{custom_string} |
custom_string |
A fixed text string you define. | Pro |
{postslug} |
postslug |
Slug of the attached post. | Pro |
{postid} |
postid |
ID of the attached post. | Pro |
{userid} |
userid |
ID of the uploading user. | Pro |
{userrole} |
userrole |
Role of the uploading user. | Pro |
{username} |
username |
Username of the uploading user. | Pro |
{wc_prod_sku} |
wc_prod_sku |
SKU of the related WooCommerce product (WooCommerce only). | Pro |
{cf:fieldname} |
custom_field_rule |
Value of a custom field on the attached post, for example {cf:_myfield}. |
Pro |
{tax:taxonomy-slug} |
taxonomy_rule |
Post terms from a taxonomy, for example {tax:category}. |
Pro |
Example #
With the Site URL, Post title and Filename rules enabled and a structure of {siteurl}{posttitle}{filename}, a file dog.jpg uploaded to a post titled “Nice Dogs” on a site named “Dogs for Life” becomes something like dogs-for-life-com-nice-dogs-dog.jpg.
Custom tokens #
Developers can add their own {token} with the frou_sanitize_file_name filter. See the hooks and filters reference for a working example.
Need a hand? #
Our team answers every ticket on the Rename Media Files support forum.