Skip to content

Switch a WordPress plugin on or off

POST /api/v2/shared-hosting/{accountId}/wordpress-plugins/{slug}/actions/toggle

Switch a WordPress plugin off or back on by renaming its folder. Use it when a plugin breaks the site and wp-admin cannot be reached. enable: false renames wp-content/plugins/<slug> to <slug>.deactivated-by-support. enable: true renames it back. The plugin must be in the list from GET /api/v2/shared-hosting/{accountId}/wordpress-plugins. Asking for the state it is already in returns 200 without a change. When both folders exist the call returns 409 name_in_use. Remove or rename one of them in the file manager first. The account must be active and on cPanel.

Authentication: An API key with the scopes write:hosting and console:services. About keys and scopes

Request

Path parameters

accountIdstringrequired
The web hosting account ID (acct_…).
slugstringrequired
The plugin’s folder name, from the plugin list.

Body

enablebooleanrequired
false switches the plugin off. true switches it back on.
domainstring
The site, as a full host name on the account. Default: the account’s main domain.

Example

POST /api/v2/shared-hosting/{accountId}/wordpress-plugins/{slug}/actions/toggle
curl -X POST "https://cloud.hostup.se/api/v2/shared-hosting/acct_01hxa3b4c5d6e7f8g9h0j1k2m3/wordpress-plugins/acct_01hxa3b4c5d6e7f8g9h0j1k2m3/actions/toggle" \
-H "Authorization: Bearer $HOSTUP_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"enable": true,
"domain": "example.com"
}'

Responses

200 The plugin’s state after the call.

Response 200
{
"slug": "contact-form-7",
"disabled": true
}
Response fields
slugstring
The plugin’s folder name.
disabledboolean
True when the plugin is switched off.

Errors

Errors are Problem Details with a stable code. Branch on the code, not on the text.

400slug, enable or domain is invalid (invalid_request).
401Unauthorized. Authentication is required.
403The key lacks a scope or the account is not active. domain_not_owned: the domain is not on this account.
404not_found: the site has no plugin with that slug or is not a WordPress site.
409name_in_use: both the plugin folder and its switched-off copy exist. account_not_eligible_cpanel: the account is not on cPanel.
429Rate limited. Retry after the limit resets. 429 responses include Retry-After seconds plus X-RateLimit-* headers.
500Internal error. Retry later or contact support if the issue persists.
502The folder could not be renamed right now (upstream_failed).