Contents
On this page

Reorder Testimonials - Plugixa Testimonial

POST /plugixatestimonial/v1/testimonials/reorder

Save the manual display order of several testimonials at once, globally or inside one category.

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

Request

POST https://your-site.example/wp-json/plugixatestimonial/v1/testimonials/reorder

Request body

Content type: application/json

Field Type Required Description
items object[] Yes { id, display_order } pairs. An entry missing either key is skipped.
category_id integer No A category id to set that category’s own order. Leave out (or 0) for the global order.

Each entry is written as sent: positions are not renumbered, and ids that do not exist are ignored. Front-end lists sorted by manual order use the category order when a display shows exactly one category.

{
  "category_id": 3,
  "items": [
    {
      "id": 42,
      "display_order": 0
    },
    {
      "id": 17,
      "display_order": 1
    }
  ]
}

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 or empty.

Plus the errors every endpoint can return.

Examples

curl -s -X POST "https://your-site.example/wp-json/plugixatestimonial/v1/testimonials/reorder" \
  -u "admin:$WP_APP_PASSWORD" \
  -H "Content-Type: application/json" \
  -d '{"category_id":3,"items":[{"id":42,"display_order":0},{"id":17,"display_order":1}]}'
<?php
$ch = curl_init('https://your-site.example/wp-json/plugixatestimonial/v1/testimonials/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([
        'category_id' => 3,
        'items'       => [
            [
                'id'            => 42,
                'display_order' => 0,
            ],
            [
                'id'            => 17,
                'display_order' => 1,
            ],
        ],
    ]),
]);
$response = json_decode(curl_exec($ch), true);
curl_close($ch);
const response = await fetch('https://your-site.example/wp-json/plugixatestimonial/v1/testimonials/reorder', {
  method: 'POST',
  headers: {
    'Authorization': 'Basic ' + btoa(`admin:${process.env.WP_APP_PASSWORD}`),
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({ category_id: 3, items: [{ id: 42, display_order: 0 }, { id: 17, display_order: 1 }] }),
});
const { data } = await response.json();

Quick Links

Share