Run WP-CLI commands
Run allowlisted WP-CLI commands on an environment from the dashboard, and learn why a command is refused.
WP-CLI is the command line for WordPress. Avaloi runs it for you on the environment you pick, from the Tools tab. Open the site, then Tools, then WP-CLI.
Open it
- Open a site and pick the environment in the top bar.
- Choose Tools, then WP-CLI.
Run a command
- Type the command without the
wpprefix, for examplecache flush. - Press Run.
The command runs as a job. The output appears when it finishes.
How Avaloi checks commands
Avaloi checks each command twice, once in your browser and again on the server. The browser check is advice only: it warns you early, but the server decides. On the server the allowlist applies at the API and again at the agent that runs the command.
A refused command shows the plain reason and a link to the docs. Through the API, a command that is not allowed returns 422 with that link.
Code changes on live
On a live environment in Git mode, commands that change code are refused, such as plugin install and eval. Code on live is deployed from Git, and nothing may write code there.
Put the change in your repository and deploy it instead. See How Git deploys work. If a plugin needs writable code and cannot work from Git, switch the environment to classic mode on the Code tab.
Quick answers
The browser warned me, but the command ran. The browser check is advice only. The server made the final call.
plugin install was refused on live.
The environment is in Git mode. Add the plugin to your repository, push, and deploy.
Can I run a command on staging? Yes. Pick staging in the top bar, then run it.
Where do I find the allowlist? A refused command links to the docs page that lists what is allowed.
API
POST /v1/environments/{id}/tools/wp-cli
Related
Still stuck?
Email [email protected] with your site name and what you tried, or send us a message.