Run WP-CLI command

Run an arbitrary WP-CLI command on a WordPress site.


POST/api/servers/{server}/sites/{id}/wordpress/wp-cli/run

Run WP-CLI command

Executes a WP-CLI command on the WordPress installation and returns the output. The wp prefix is added automatically and can be omitted. Requires WP-CLI to be installed on the server.

Required attributes

  • Name
    command
    Type
    string
    Description

    The WP-CLI command to run (e.g. core version, plugin list --format=json, cache flush). The wp prefix is optional.

Query parameters

  • Name
    ondemand
    Type
    boolean
    Description

    When set to true, the command runs synchronously and returns the result directly. When omitted or false (default), the action is queued and processed in the background.

Request

POST
/api/servers/{server}/sites/{id}/wordpress/wp-cli/run
curl -X POST "https://ploi.io/api/servers/{server}/sites/{id}/wordpress/wp-cli/run?ondemand=true" \
  -H "Authorization: Bearer {token}" \
  -H "Content-Type: application/json" \
  -H "Accept: application/json" \
  -d '{"command": "core version"}'

Response

{
  "output": "6.7.2\n"
}