Contents
Bulk Action on Testimonials - Plugixa Testimonial
POST /plugixatestimonial/v1/testimonials/bulk-action
Approve, reject, feature or unfeature several testimonials in one request.
Any signed-in user with the plugixa_testimonial_approve capability or WordPress’s publish_posts (Authors and up, by default).
Request
POST https://your-site.example/wp-json/plugixatestimonial/v1/testimonials/bulk-action
Request body
Content type: application/json
| Field | Type | Required | Description |
|---|---|---|---|
ids |
integer[] |
Yes | Testimonial ids. |
action |
string |
Yes | approve, reject, feature or unfeature. |
approve sets the status to approved and records approved_at and approved_by; reject sets rejected. feature and unfeature change only the featured flag. There is no bulk action back to pending or draft: use Change Status. Translations are not changed.
{
"ids": [
42,
43
],
"action": "approve"
}
Responses
200 OK.
{
"success": true,
"message": "Bulk action completed on 2 testimonials",
"data": {
"affected": 2
}
}
| Field | Type | Meaning |
|---|---|---|
data.affected |
integer |
Rows the database changed |
message |
string |
A human-readable confirmation, translated to the site language |
Errors
| Status | Code | When |
|---|---|---|
400 |
rest_error |
“No IDs provided”, or “Invalid action”. |
500 |
rest_error |
The database refused the update. |
Plus the errors every endpoint can return.
Examples
curl -s -X POST "https://your-site.example/wp-json/plugixatestimonial/v1/testimonials/bulk-action" \
-u "admin:$WP_APP_PASSWORD" \
-H "Content-Type: application/json" \
-d '{"ids":[42,43],"action":"approve"}'
<?php
$ch = curl_init('https://your-site.example/wp-json/plugixatestimonial/v1/testimonials/bulk-action');
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([
'ids' => [42, 43],
'action' => 'approve',
]),
]);
$response = json_decode(curl_exec($ch), true);
curl_close($ch);
const response = await fetch('https://your-site.example/wp-json/plugixatestimonial/v1/testimonials/bulk-action', {
method: 'POST',
headers: {
'Authorization': 'Basic ' + btoa(`admin:${process.env.WP_APP_PASSWORD}`),
'Content-Type': 'application/json',
},
body: JSON.stringify({ ids: [42, 43], action: 'approve' }),
});
const { data } = await response.json();
Quick Links
Share