Contents
On this page
Update FAQ - Plugixa FAQ
PUT /plugixa-faq/v1/faqs/{id}
Rewrite a FAQ 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, not a merge, and it answers
200either way. A field you leave out goes back to its default:statusbecomesdraft(the FAQ is unpublished),visibilitybecomespublic,menu_orderbecomes0,category_idis cleared, andslugis made again from the question, which drops a custom slug. Onlyimage_id,parent_id,author_alias,feedback_enabledandcustom_fieldsare kept when omitted. Read the FAQ with Get FAQ, change what you need, and send every field back.
Note. There is no existence check: an id that matches nothing still answers
200with the success message, and nothing is created.
Request
PUT https://your-site.example/wp-json/plugixa-faq/v1/faqs/42
Path parameters
| Name | Type | Description |
|---|---|---|
id |
integer |
The FAQ’s id |
Request body
Content type: application/json
| Field | Type | Required | Description |
|---|---|---|---|
question |
string |
Yes | Plain text, at least 5 characters. HTML tags are stripped. |
answer |
string |
Yes | HTML. Tags not allowed in a WordPress post are stripped. Must not end up empty. |
slug |
string |
No | Made from the question when empty. Made unique by appending -2, -3, … |
category_id |
integer |
No | The category. 0 or omitted means no category. |
status |
string |
No | draft (the default) or published. |
visibility |
string |
No | public (the default), private or password. Only public FAQs are shown to visitors. |
menu_order |
integer |
No | Position in manual ordering. Defaults to 0. |
parent_id |
integer|null |
No | Nest this FAQ under another one. See Nested FAQs. |
image_id |
integer|null |
No | A Media Library attachment id shown with the answer. |
author_alias |
string |
No | A name to show instead of the WordPress author. |
feedback_enabled |
boolean|null |
No | true or false overrides the category; null or "inherit" follows the category. |
custom_fields |
object |
No | Custom field values, keyed by field key. An empty value removes that field from the FAQ. See Custom fields PRO. |
parent_id cannot be the FAQ itself or one of its own children. custom_fields is merged key by key: keys you do not send keep their values. language_code and translation_group are ignored here: use Link Translations.
{
"question": "How long does shipping take?",
"answer": "<p>Orders ship within 1 business day.</p>",
"slug": "how-long-does-shipping-take",
"category_id": 3,
"status": "published",
"visibility": "public",
"menu_order": 0
}
Responses
200 OK.
{
"success": true,
"message": "FAQ updated successfully",
"data": {
"id": 42
}
}
| 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 question is missing or shorter than 5 characters, the answer is empty, or parent_id is the FAQ itself or one of its descendants. data.errors names the field. |
400 |
rest_invalid_param |
status or visibility is not one of the listed values. |
500 |
rest_error |
The database refused the change. |
Plus the errors every endpoint can return.
Examples
curl -s -X PUT "https://your-site.example/wp-json/plugixa-faq/v1/faqs/42" \
-u "admin:$WP_APP_PASSWORD" \
-H "Content-Type: application/json" \
-d '{"question":"How long does shipping take?","answer":"<p>Orders ship within 1 business day.</p>","slug":"how-long-does-shipping-take","category_id":3,"status":"published","visibility":"public","menu_order":0}'
<?php
$ch = curl_init('https://your-site.example/wp-json/plugixa-faq/v1/faqs/42');
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([
'question' => 'How long does shipping take?',
'answer' => '<p>Orders ship within 1 business day.</p>',
'slug' => 'how-long-does-shipping-take',
'category_id' => 3,
'status' => 'published',
'visibility' => 'public',
'menu_order' => 0,
]),
]);
$response = json_decode(curl_exec($ch), true);
curl_close($ch);
const response = await fetch('https://your-site.example/wp-json/plugixa-faq/v1/faqs/42', {
method: 'PUT',
headers: {
'Authorization': 'Basic ' + btoa(`admin:${process.env.WP_APP_PASSWORD}`),
'Content-Type': 'application/json',
},
body: JSON.stringify({ question: 'How long does shipping take?', answer: '<p>Orders ship within 1 business day.</p>', slug: 'how-long-does-shipping-take', category_id: 3, status: 'published', visibility: 'public', menu_order: 0 }),
});
const { data } = await response.json();
Quick Links
Share