Every site has a dozen one-off commands nobody wants to write
"Export all orders from last week as CSV." "List every user who hasn't logged in for 90 days." "Toggle this one option on and off." Each is a five-minute PHP snippet — if you know WordPress well enough to write it. If you don't, it's a ticket to a developer, a cost estimate, a round-trip review, and three weeks of waiting for a task the site owner could have done in a minute given the right interface.
What most people do instead
A better way: name it, describe it, ship it
Run ai generate command -name="export orders" -context="Create a command that exports last 30 days of orders as CSV with customer name, total, and status". AI returns exactly two code blocks — PHP for the handle($data) body and JavaScript for the response renderer. TrueCommander saves both to uploads/trc/commands/, registers the new command, and it's immediately runnable from the navigator.
Admin-only, by design. The command writes executable PHP to your uploads folder, so the guard is stricter than other AI commands — manage_options required even if you've granted AI access to other roles. The generated file also gets an ABSPATH exit guard prepended and .htaccess protection on its parent directory.
How it works
Your name and context are sanitized, interpolated into a strict prompt template that tells the AI the exact wrapper class/method structure, the output format (two fenced code blocks), and the WordPress-function conventions to follow. The response is parsed, each block is written to the appropriate file (PHP to command_{id}.php, JS to the matching renderer), and the custom command is registered under the name you provided.
| Parameter | Value |
|---|---|
-name(required) | Command name — how you'll invoke it (tp your-name) |
-context(required) | Plain-English description of what the command should do |
| Output | PHP handler + JS renderer, saved to uploads/trc/commands/ |
| Permissions | manage_options required — stricter than other AI commands because executable PHP gets written to disk |
| AI provider | TrueCommander's server-side proxy — no API key required, no provider choice |
| Can be used in |
Real example
You manage a WooCommerce store and want a weekly view of which customers haven't reordered in 60 days — for a reactivation campaign. You open the navigator and run ai generate command -name="stale customers" -context="List customers whose last order is older than 60 days. Return email, full name, and days since last order. Sort by days descending. Show the first 50."
AI writes 35 lines of PHP (WP_User_Query + meta filtering on _last_order_date) and 12 lines of JS (table output with email and days-since columns). The command is now called stale customers. Next time you want the list, you type tp stale customers — no prompt, no AI call, just your stored command running against your live data.