Update site category
const url = 'https://example.com/wp-json/wp2/site-manager/v1/categories/1';const options = { method: 'PATCH', headers: {'X-WP-Nonce': '<X-WP-Nonce>', 'Content-Type': 'application/json'}, body: '{"name":"Training projects"}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request PATCH \ --url https://example.com/wp-json/wp2/site-manager/v1/categories/1 \ --header 'Content-Type: application/json' \ --header 'X-WP-Nonce: <X-WP-Nonce>' \ --data '{ "name": "Training projects" }'Partially updates the category term: name, slug, parent_id. Empty body — return the current term without writing. Requires manage_network.
Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Path Parameters
Section titled “Path Parameters”Site Manager category term_id.
Request Body
Section titled “Request Body”object
New name. Missing key — leave unchanged.
New slug (sanitize_title). Missing key — leave unchanged.
New parent. The key must be present for PHP to change parent (including to 0).
Example
{ "name": "Training projects"}Responses
Section titled “Responses”Category after update.
object
Site category term_id (Site Manager taxonomy, not post categories).
Term display name. In the list PHP may rewrite default labels via translate_default_term_label.
Category term slug (sanitize_title on write).
Parent term_id (WP_Term->parent); 0 — root. PHP omits this field in SiteDto.categories.
Example
{ "id": 3, "name": "Training projects", "slug": "training", "parent": 0}wp_update_term WP_Error other than term_exists.
object
Machine-readable error or event code.
Message text (log, PIN, or password reset).
Extra WP_Error or license payload.
object
Examplegenerated
{ "code": "example", "message": "example", "data": {}}Not authenticated. DualRest: rest_forbidden (status 401) when there is no cookie session. Cookie + X-WP-Nonce or Application Password.
object
Machine-readable error or event code.
Message text (log, PIN, or password reset).
Extra WP_Error or license payload.
object
Examplegenerated
{ "code": "example", "message": "example", "data": {}}Missing manage_network or invalid REST nonce.
object
Machine-readable error or event code.
Message text (log, PIN, or password reset).
Extra WP_Error or license payload.
object
Examplegenerated
{ "code": "example", "message": "example", "data": {}}Term_not_found — no such category term.
object
Machine-readable error or event code.
Message text (log, PIN, or password reset).
Extra WP_Error or license payload.
object
Examplegenerated
{ "code": "example", "message": "example", "data": {}}Term_exists — name/slug conflict.
object
Machine-readable error or event code.
Message text (log, PIN, or password reset).
Extra WP_Error or license payload.
object
Examplegenerated
{ "code": "example", "message": "example", "data": {}}