Contents
On this page

Delete Several Testimonials - Plugixa Testimonial

DELETE /plugixatestimonial/v1/testimonials/bulk

Delete several testimonials for good in one request, with their category links and custom field values.

Any signed-in user with the plugixa_testimonial_delete capability or WordPress’s delete_others_posts (Editors and Administrators, by default).

Note. Translations of the testimonials you list are not deleted: list their ids too.

Request

DELETE https://your-site.example/wp-json/plugixatestimonial/v1/testimonials/bulk

Request body

Content type: application/json

Field Type Required Description
ids integer[] Yes Testimonial ids. Ids that match nothing are ignored.
{
  "ids": [
    42,
    43,
    51
  ]
}

Responses

200 OK.

{
  "success": true,
  "message": "3 testimonials deleted successfully",
  "data": {
    "deleted": 3
  }
}
Field Type Meaning
data.deleted integer Testimonials actually deleted
message string A human-readable confirmation, translated to the site language

Errors

Status Code When
400 rest_error “No IDs provided”: ids is missing, empty or not an array.
500 rest_error The database refused the delete.

Plus the errors every endpoint can return.

Examples

curl -s -X DELETE "https://your-site.example/wp-json/plugixatestimonial/v1/testimonials/bulk" \
  -u "admin:$WP_APP_PASSWORD" \
  -H "Content-Type: application/json" \
  -d '{"ids":[42,43,51]}'
<?php
$ch = curl_init('https://your-site.example/wp-json/plugixatestimonial/v1/testimonials/bulk');
curl_setopt_array($ch, [
    CURLOPT_CUSTOMREQUEST  => 'DELETE',
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_USERPWD        => 'admin:' . getenv('WP_APP_PASSWORD'),
    CURLOPT_HTTPHEADER     => ['Content-Type: application/json'],
    CURLOPT_POSTFIELDS     => json_encode([
        'ids' => [42, 43, 51],
    ]),
]);
$response = json_decode(curl_exec($ch), true);
curl_close($ch);
const response = await fetch('https://your-site.example/wp-json/plugixatestimonial/v1/testimonials/bulk', {
  method: 'DELETE',
  headers: {
    'Authorization': 'Basic ' + btoa(`admin:${process.env.WP_APP_PASSWORD}`),
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({ ids: [42, 43, 51] }),
});
const { data } = await response.json();

Quick Links

Share