Contents
Reorder FAQs - Plugixa FAQ
POST /plugixa-faq/v1/faqs/reorder
Set menu_order, and optionally the parent, of several FAQs at once.
Any signed-in user with the plugixa_faq_edit capability or WordPress’s edit_posts (Contributors and up, by default).
Note. Items are applied one by one and problems are skipped silently: an item without
idormenu_orderis ignored, and so is an item whose newparent_idis itself or one of its own children (itsmenu_orderis not applied either). The answer is200in every case.
Request
POST https://your-site.example/wp-json/plugixa-faq/v1/faqs/reorder
Request body
Content type: application/json
| Field | Type | Required | Description |
|---|---|---|---|
items |
array |
Yes | One object per FAQ to move. |
items[].id |
integer |
Yes | The FAQ. |
items[].menu_order |
integer |
Yes | Its new position. Lower comes first. |
items[].parent_id |
integer|null |
No | Send it to move the FAQ under another FAQ, or null to move it to the top level. Leave it out to keep the current parent. |
See Ordering for how the order is used on the page.
{
"items": [
{
"id": 42,
"menu_order": 0
},
{
"id": 43,
"menu_order": 1,
"parent_id": 42
}
]
}
Responses
200 OK.
{
"success": true,
"message": "Order updated successfully",
"data": null
}
| Field | Type | Meaning |
|---|---|---|
message |
string |
A human-readable confirmation, translated to the site language |
Errors
| Status | Code | When |
|---|---|---|
400 |
rest_error |
“No items provided”: items is missing, empty or not a list. |
Plus the errors every endpoint can return.
Examples
curl -s -X POST "https://your-site.example/wp-json/plugixa-faq/v1/faqs/reorder" \
-u "admin:$WP_APP_PASSWORD" \
-H "Content-Type: application/json" \
-d '{"items":[{"id":42,"menu_order":0},{"id":43,"menu_order":1,"parent_id":42}]}'
<?php
$ch = curl_init('https://your-site.example/wp-json/plugixa-faq/v1/faqs/reorder');
curl_setopt_array($ch, [
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_USERPWD => 'admin:' . getenv('WP_APP_PASSWORD'),
CURLOPT_HTTPHEADER => ['Content-Type: application/json'],
CURLOPT_POSTFIELDS => json_encode([
'items' => [
[
'id' => 42,
'menu_order' => 0,
],
[
'id' => 43,
'menu_order' => 1,
'parent_id' => 42,
],
],
]),
]);
$response = json_decode(curl_exec($ch), true);
curl_close($ch);
const response = await fetch('https://your-site.example/wp-json/plugixa-faq/v1/faqs/reorder', {
method: 'POST',
headers: {
'Authorization': 'Basic ' + btoa(`admin:${process.env.WP_APP_PASSWORD}`),
'Content-Type': 'application/json',
},
body: JSON.stringify({ items: [{ id: 42, menu_order: 0 }, { id: 43, menu_order: 1, parent_id: 42 }] }),
});
const { data } = await response.json();
Quick Links
Share