WP-CLI commands
The five WP-CLI commands Aimogen Pro registers for generating content, editing posts and running rules from the command line.
Aimogen Pro registers WP-CLI commands for content generation, bulk editing and running rules — useful for scripting, scheduling outside WP-Cron, and processing large batches without a browser.
This tutorial was recorded before Aiomatic was renamed to Aimogen Pro. Some labels or interface elements may differ slightly from the current version.
This tutorial was recorded before Aiomatic was renamed to Aimogen Pro. Some labels or interface elements may differ slightly from the current version.
Enabling#
Settings › WP-CLI › Enable WP-CLI must be on. Without it the commands are not registered.
An API key must also be configured; every command errors out with
You need to add an AI API key in the Aimogen plugin settings for this to work! otherwise.
The commands#
| Command | Alias | Purpose |
|---|---|---|
wp aicontent | — | Generate text from a prompt |
wp aimogen-edit | wp aiomatic-edit | Run the AI Content Editor over posts |
wp aimogen-run | wp aiomatic-run | Run a bulk rule or workflow |
wp aimogen-agent | — | Run an AI Agent |
Both aimogen- and aiomatic- spellings are registered for the edit and run commands.
wp aicontent <model> <prompt>#
wp aicontent gpt-5-mini "Write a two-sentence summary of WP-CLI"Prints the generated text. Errors on an empty prompt or an empty response.
wp aimogen-edit <post_id_list> [<editing_template_ID>]#
# One post, default template
wp aimogen-edit 42
# Several posts, a specific editor template
wp aimogen-edit 42,43,44,45 7| Parameter | Required | Meaning |
|---|---|---|
post_id_list | yes | Comma-separated post IDs |
editing_template_ID | no | An editor template ID. Omitted means default handling |
Limit: 1000 post IDs per invocation. More errors with Too many posts.
The command flushes the object cache and runs garbage collection every ten posts, which is what makes large batches survivable.
wp aimogen-run <rule_type> <rule_id>#
# Rule 3 of the keyword creator
wp aimogen-run 0 3
# Several OmniBlock workflows
wp aimogen-run 5 1,2,7| Rule type | Creator |
|---|---|
0 | Keywords/Titles to blog posts |
1 | YouTube videos to posts |
2 | AI product roundup |
3 | AI product reviews |
4 | CSV AI post creator |
5 | OmniBlocks |
6 | Listicles |
7 | Forum topics |
8 | Topic replies |
Rule IDs may be comma-separated.
wp aimogen-agent <agent_id> [--task=<task>] [--verbose]#
# Run agent 42 with its stored task
wp aimogen-agent 42
# Run it with a specific task, showing the result
wp aimogen-agent 42 --task="Find posts published this month with no featured image and report their IDs" --verbose| Parameter | Required | Meaning |
|---|---|---|
agent_id | yes | The agent post ID |
--task | no | A task for this run. Without it, the agent stored task is used |
--verbose | no | Print the result as well as the timing |
The command clears the agent working memory and current task before starting, sets its status to running, and executes synchronously — unlike the admin path, which dispatches one step per cron event.
It reports the elapsed time on success, and errors with the exception message if the agent crashes.
Why the CLI is worth using#
No PHP timeout. CLI execution is not bounded by web server limits, so large batches complete.
Real scheduling. Drive generation from system cron rather than WP-Cron:
# Every night at 02:00, run keyword rule 3
0 2 * * * cd /var/www/example.com && wp aimogen-run 0 3 >> /var/log/aimogen.log 2>&1Bulk editing at scale. Editing a thousand posts through the admin means many browser batches. From the CLI it is one command.
# Edit every post in category 5 with template 7
wp post list --category=5 --format=ids --posts_per_page=-1 \
| tr ' ' ',' \
| xargs -I {} wp aimogen-edit {} 7Deterministic ordering. The CLI processes in the order you supply.
Practical guidance#
Redirect output to a log. Errors are the thing you will want afterwards.
Watch memory. The edit command cleans up periodically, but very large batches on a small server still
need --skip-plugins for unrelated plugins, or a raised memory limit.
Costs are real. A CLI command bypasses no limits — it makes the same paid API calls. Check System & Logs › Usage Logs afterwards.
Multisite. Use --url= to target a specific site.
wp aimogen-run 0 3 --url=https://sub.example.comCommon problems#
wp aicontent is not a registered command. WP-CLI is enabled in settings but the plugin is not
loading — check that you are running wp from the WordPress root, and that the plugin is active.
You need to add an AI API key. No key configured, or you are targeting the wrong site on multisite.
Too many posts. More than 1000 IDs. Split the batch.
Parameters missing. The command prints its usage. Note that aimogen-run requires rule type
and rule ID, in that order.
The command hangs. A slow model, or a rule making many requests. It is working; watch Live AI Activity in another window.
Related#
Still stuck? Open a support ticket and include the diagnostics from Aimogen Pro › System & Logs › System Info.