Transient Key Generator
Build safe, length-limited WordPress transient keys from a prefix and a name, with ready-to-paste set_transient and get_transient lines. Runs in your browser.
n/a n/a 0 / 172 n/a About the Transient Key Generator
The Transient Key Generator builds safe, valid WordPress transient keys from a plugin prefix and a descriptive name. It lowercases the text, swaps unsafe characters for underscores, and checks the result against the WordPress length limit. If a key is too long, it offers a hashed short variant so you stay under the limit. It also outputs ready-to-paste set_transient and get_transient lines. Everything runs in your browser, so nothing you type is sent to a server.
How it works
- Enter a plugin or feature prefix and a descriptive name. Add optional variable parts if your key needs to change per user, post, or query.
- The tool slugifies each part, joins them with underscores, and shows the final key with its character count.
- If the key passes the 172 character limit for a normal transient, you get a warning and a shortened variant that uses the prefix plus a short hash.
- Copy the key, or copy the generated set_transient and get_transient example lines.
Features
- Safe key output: lowercase, underscores only, no spaces or special characters.
- Length check against the 172 character WordPress transient option name limit.
- Hashed short variant when a key would exceed the limit, keeping the prefix readable.
- Optional variable parts for keys that vary by user, post, or context.
- Copy buttons for the key and for ready-to-use set_transient and get_transient lines.
Frequently asked questions
What is the transient key length limit?
A normal transient is stored in wp_options as _transient_{key}, and the full option name must fit in 172 characters. WordPress also stores _transient_timeout_{key}, so keeping keys short avoids problems. Site transients used with set_site_transient have a tighter 45 character limit.
What happens if my key is too long?
WordPress can silently truncate over-length option names, which causes two different keys to collide and overwrite each other. This tool warns you and offers a shortened variant built from the prefix plus a short hash of the full name, so the key stays unique and within the limit.
Which characters are safe in a transient key?
Stick to lowercase letters, numbers, and underscores. The tool converts spaces and other characters to underscores, collapses repeats, and trims leading or trailing underscores so the key is predictable and collision-resistant.
Why use a prefix?
A prefix namespaces your key to your plugin or feature. Without one, two plugins can pick the same name and overwrite each other's cached data. A short, unique prefix keeps your transients separate.
Is anything sent to a server?
No. The key is built and the snippets are generated entirely in your browser with plain JavaScript. Nothing you type leaves your device.