Contents
On this page

Update Category - Plugixa FAQ

PUT /plugixa-faq/v1/categories/{id}

Rewrite a category from the request body.

Any signed-in user with the plugixa_faq_edit capability or WordPress’s edit_posts (Contributors and up, by default).

Note. This is a full replace. A field you leave out is reset: description and icon become empty, color is cleared, menu_order becomes 0 and feedback_enabled goes back to true. Always send slug: without it the slug is saved empty, which breaks category filters that use the slug, and a second category saved without a slug then fails with 500. There is no existence check: an id that matches nothing still answers 200 with the success message, and nothing changes.

Request

PUT https://your-site.example/wp-json/plugixa-faq/v1/categories/3

Path parameters

Name Type Description
id integer The category’s id

Request body

Content type: application/json

Field Type Required Description
name string Yes Plain text, at least 2 characters.
slug string No Made from the name when empty. Made unique by appending -1, -2, …
description string No Plain text; line breaks are kept.
icon string No Icon name shown with the category.
color string No Hex colour such as #2271b1. Anything else is stored as null.
menu_order integer No Position in manual ordering. Defaults to 0.
feedback_enabled boolean No Whether FAQs in this category show the feedback widget PRO when they do not decide for themselves. Defaults to true.

language_code and translation_group are ignored here: use Link Translations.

{
  "name": "Shipping",
  "slug": "shipping",
  "description": "Delivery times and costs.",
  "icon": "",
  "color": "#2271b1",
  "menu_order": 0,
  "feedback_enabled": true
}

Responses

200 OK.

{
  "success": true,
  "message": "Category updated successfully",
  "data": {
    "id": 3
  }
}
Field Type Meaning
data.id integer The id from the path
message string A human-readable confirmation, translated to the site language

Errors

Status Code When
400 rest_error “Validation failed”: the name is missing, empty or shorter than 2 characters.
500 rest_error The database refused the change, for example a duplicate empty slug.

Plus the errors every endpoint can return.

Examples

curl -s -X PUT "https://your-site.example/wp-json/plugixa-faq/v1/categories/3" \
  -u "admin:$WP_APP_PASSWORD" \
  -H "Content-Type: application/json" \
  -d '{"name":"Shipping","slug":"shipping","description":"Delivery times and costs.","icon":"","color":"#2271b1","menu_order":0,"feedback_enabled":true}'
<?php
$ch = curl_init('https://your-site.example/wp-json/plugixa-faq/v1/categories/3');
curl_setopt_array($ch, [
    CURLOPT_CUSTOMREQUEST  => 'PUT',
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_USERPWD        => 'admin:' . getenv('WP_APP_PASSWORD'),
    CURLOPT_HTTPHEADER     => ['Content-Type: application/json'],
    CURLOPT_POSTFIELDS     => json_encode([
        'name'             => 'Shipping',
        'slug'             => 'shipping',
        'description'      => 'Delivery times and costs.',
        'icon'             => '',
        'color'            => '#2271b1',
        'menu_order'       => 0,
        'feedback_enabled' => true,
    ]),
]);
$response = json_decode(curl_exec($ch), true);
curl_close($ch);
const response = await fetch('https://your-site.example/wp-json/plugixa-faq/v1/categories/3', {
  method: 'PUT',
  headers: {
    'Authorization': 'Basic ' + btoa(`admin:${process.env.WP_APP_PASSWORD}`),
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({ name: 'Shipping', slug: 'shipping', description: 'Delivery times and costs.', icon: '', color: '#2271b1', menu_order: 0, feedback_enabled: true }),
});
const { data } = await response.json();

Quick Links

Share