Contents
On this page

Reorder Custom Fields - Plugixa FAQ

POST /plugixa-faq/v1/custom-fields/reorder

Set menu_order on several custom fields at once.

Administrators only: the user needs the plugixa_faq_settings capability or WordPress’s manage_options. Needs Plugixa FAQ Pro: the free build does not register this route, so it answers 404 there.

Note. Unknown ids change nothing and the answer is still 200. Send id and menu_order on every item.

Request

POST https://your-site.example/wp-json/plugixa-faq/v1/custom-fields/reorder

Request body

Content type: application/json

Field Type Required Description
items array Yes One object per field.
items[].id integer Yes The field.
items[].menu_order integer Yes Its new position. Lower comes first.
{
  "items": [
    {
      "id": 5,
      "menu_order": 0
    },
    {
      "id": 6,
      "menu_order": 1
    }
  ]
}

Responses

200 OK.

{
  "success": true,
  "message": "Order updated",
  "data": null
}
Field Type Meaning
message string A human-readable confirmation, translated to the site language

Errors

Status Code When
400 rest_error “Invalid items”: items is missing 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/custom-fields/reorder" \
  -u "admin:$WP_APP_PASSWORD" \
  -H "Content-Type: application/json" \
  -d '{"items":[{"id":5,"menu_order":0},{"id":6,"menu_order":1}]}'
<?php
$ch = curl_init('https://your-site.example/wp-json/plugixa-faq/v1/custom-fields/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'         => 5,
                'menu_order' => 0,
            ],
            [
                'id'         => 6,
                'menu_order' => 1,
            ],
        ],
    ]),
]);
$response = json_decode(curl_exec($ch), true);
curl_close($ch);
const response = await fetch('https://your-site.example/wp-json/plugixa-faq/v1/custom-fields/reorder', {
  method: 'POST',
  headers: {
    'Authorization': 'Basic ' + btoa(`admin:${process.env.WP_APP_PASSWORD}`),
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({ items: [{ id: 5, menu_order: 0 }, { id: 6, menu_order: 1 }] }),
});
const { data } = await response.json();

Quick Links

Share