Contents
On this page
Update Shortcode - Plugixa Testimonial
PUT /plugixatestimonial/v1/shortcodes/{id}
Change a saved shortcode. Only the fields you send are changed.
Any signed-in user with the plugixa_testimonial_edit capability or WordPress’s edit_posts (Contributors and up, by default).
Note.
config, when sent, is merged over the defaults, not over the stored configuration: a key you leave out goes back to its default (for examplelimitto-1). Send the wholeconfig. There is no existence check: an id that matches nothing still answers200with the success message, and nothing changes.
Request
PUT https://your-site.example/wp-json/plugixatestimonial/v1/shortcodes/7
Path parameters
| Name | Type | Description |
|---|---|---|
id |
integer |
The shortcode’s id |
Request body
Content type: application/json
| Field | Type | Required | Description |
|---|---|---|---|
name |
string |
No | Must not be blank when sent. |
slug |
string |
No | Made unique by appending -1, -2, … |
description |
string |
No | Plain text. |
config |
object |
No | The complete configuration. |
config is merged over the defaults: view_id null (the default view), categories [] (all), limit -1 (all), orderby display_order, order ASC, featured_only false, min_rating 0, every display toggle on except showWebsite, and schema true. orderby takes display_order, created_at, rating or client_name. Values are stored as sent.
{
"name": "Agency reviews",
"config": {
"view_id": 2,
"categories": [
3
],
"limit": 6,
"orderby": "display_order",
"order": "ASC",
"featured_only": false,
"min_rating": 4,
"display": {
"showPhoto": true,
"showRating": true,
"showRole": true,
"showCompany": true,
"showDate": true,
"showWebsite": false,
"showQuoteIcon": true,
"showCustomFields": true
},
"schema": true
}
}
Responses
200 OK.
{
"success": true,
"message": "Shortcode updated successfully",
"data": {
"id": 7
}
}
| Field | Type | Meaning |
|---|---|---|
data.id |
integer |
The id you sent |
message |
string |
A human-readable confirmation, translated to the site language |
Errors
| Status | Code | When |
|---|---|---|
400 |
rest_error |
“Validation failed”. data.errors names the field: name (blank). |
500 |
rest_error |
The database refused the update. |
Plus the errors every endpoint can return.
Examples
curl -s -X PUT "https://your-site.example/wp-json/plugixatestimonial/v1/shortcodes/7" \
-u "admin:$WP_APP_PASSWORD" \
-H "Content-Type: application/json" \
-d '{"name":"Agency reviews","config":{"view_id":2,"categories":[3],"limit":6,"orderby":"display_order","order":"ASC","featured_only":false,"min_rating":4,"display":{"showPhoto":true,"showRating":true,"showRole":true,"showCompany":true,"showDate":true,"showWebsite":false,"showQuoteIcon":true,"showCustomFields":true},"schema":true}}'
<?php
$ch = curl_init('https://your-site.example/wp-json/plugixatestimonial/v1/shortcodes/7');
curl_setopt_array($ch, [
CURLOPT_CUSTOMREQUEST => 'PUT',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_USERPWD => 'admin:' . getenv('WP_APP_PASSWORD'),
CURLOPT_HTTPHEADER => ['Content-Type: application/json'],
CURLOPT_POSTFIELDS => json_encode([
'name' => 'Agency reviews',
'config' => [
'view_id' => 2,
'categories' => [3],
'limit' => 6,
'orderby' => 'display_order',
'order' => 'ASC',
'featured_only' => false,
'min_rating' => 4,
'display' => [
'showPhoto' => true,
'showRating' => true,
'showRole' => true,
'showCompany' => true,
'showDate' => true,
'showWebsite' => false,
'showQuoteIcon' => true,
'showCustomFields' => true,
],
'schema' => true,
],
]),
]);
$response = json_decode(curl_exec($ch), true);
curl_close($ch);
const response = await fetch('https://your-site.example/wp-json/plugixatestimonial/v1/shortcodes/7', {
method: 'PUT',
headers: {
'Authorization': 'Basic ' + btoa(`admin:${process.env.WP_APP_PASSWORD}`),
'Content-Type': 'application/json',
},
body: JSON.stringify({ name: 'Agency reviews', config: { view_id: 2, categories: [3], limit: 6, orderby: 'display_order', order: 'ASC', featured_only: false, min_rating: 4, display: { showPhoto: true, showRating: true, showRole: true, showCompany: true, showDate: true, showWebsite: false, showQuoteIcon: true, showCustomFields: true }, schema: true } }),
});
const { data } = await response.json();
Quick Links
Share