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, review it
Run tp 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 a disabled Custom Command for an administrator to inspect, edit and enable.
Shown in advanced mode, where commands start with tp. In easy mode you type the same command without the tp prefix.
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) | What to call the new command (e.g. "export orders") |
-context (required) | Describe what the command should do, in plain language |
| 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 tp 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 returns draft PHP and JS. Check the generated query, permissions and output before enabling the command. The result is a disabled Custom Command named stale customers. Review the generated PHP and JS, enable it, then run it from the navigator.
Goes further with TrueCommander
Frequently asked questions
tp ai generate command -name="export orders" -context="Export all orders to CSV.". The AI drafts PHP and JS and saves a disabled Custom Command for review.tp ai.