Contents
On this page
Update Shortcode - Plugixa FAQ
PUT /plugixa-faq/v1/shortcodes/{id}
Change a saved shortcode’s name, slug, description or settings.
Any signed-in user with the plugixa_faq_edit capability or WordPress’s edit_posts (Contributors and up, by default).
Note.
name,sluganddescriptionchange only when sent, butconfigis rebuilt from the defaults plus what you send: keys you leave out go back to their defaults. Send the wholeconfigfrom Get Shortcode. 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/plugixa-faq/v1/shortcodes/12
Path parameters
| Name | Type | Description |
|---|---|---|
id |
integer |
The shortcode’s id |
Request body
Content type: application/json
| Field | Type | Required | Description |
|---|---|---|---|
name |
string |
No | At least 2 characters. |
slug |
string |
No | Made from the name when empty, and then made unique. A slug you send must not be taken already. |
description |
string |
No | Plain text. |
config |
object |
No | The settings, in the shape Get Shortcode returns. Merged over the defaults, so you can send only the keys you change. |
{
"name": "Shipping FAQ",
"config": {
"view": "support-centre",
"categories": [
"shipping"
],
"ids": [],
"limit": -1,
"pagination": "none",
"perPage": 10,
"orderby": "menu_order",
"order": "ASC",
"search": true,
"searchPlaceholder": "",
"groupByCategory": false,
"schema": true,
"darkMode": "from_view",
"openFirst": false,
"allowMultiple": true,
"enablePermalinks": true,
"permalinkText": "Permalink",
"permalinkPosition": "answer-top-right",
"enableSocialShare": false,
"feedbackEnabled": false,
"paginationEnabled": true,
"paginationStyle": "numbers",
"loadMoreLabel": "Load More",
"enableToggleAll": false,
"showReadMore": false,
"readMoreText": "Read More",
"showAuthor": true,
"showDate": true,
"showCategory": true
}
}
Responses
200 OK.
{
"success": true,
"message": "Shortcode updated successfully",
"data": {
"id": 12
}
}
| Field | Type | Meaning |
|---|---|---|
data.id |
integer |
The id from the path |
message |
string |
A human-readable confirmation, translated to the site language |
Errors
| Status | Code | When |
|---|---|---|
400 |
rest_error |
“Validation failed”: the name is empty or shorter than 2 characters, or the slug belongs to another shortcode. |
500 |
rest_error |
The database refused the change. |
Plus the errors every endpoint can return.
Examples
curl -s -X PUT "https://your-site.example/wp-json/plugixa-faq/v1/shortcodes/12" \
-u "admin:$WP_APP_PASSWORD" \
-H "Content-Type: application/json" \
-d '{"name":"Shipping FAQ","config":{"view":"support-centre","categories":["shipping"],"ids":[],"limit":-1,"pagination":"none","perPage":10,"orderby":"menu_order","order":"ASC","search":true,"searchPlaceholder":"","groupByCategory":false,"schema":true,"darkMode":"from_view","openFirst":false,"allowMultiple":true,"enablePermalinks":true,"permalinkText":"Permalink","permalinkPosition":"answer-top-right","enableSocialShare":false,"feedbackEnabled":false,"paginationEnabled":true,"paginationStyle":"numbers","loadMoreLabel":"Load More","enableToggleAll":false,"showReadMore":false,"readMoreText":"Read More","showAuthor":true,"showDate":true,"showCategory":true}}'
<?php
$ch = curl_init('https://your-site.example/wp-json/plugixa-faq/v1/shortcodes/12');
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' => 'Shipping FAQ',
'config' => [
'view' => 'support-centre',
'categories' => ['shipping'],
'ids' => [],
'limit' => -1,
'pagination' => 'none',
'perPage' => 10,
'orderby' => 'menu_order',
'order' => 'ASC',
'search' => true,
'searchPlaceholder' => '',
'groupByCategory' => false,
'schema' => true,
'darkMode' => 'from_view',
'openFirst' => false,
'allowMultiple' => true,
'enablePermalinks' => true,
'permalinkText' => 'Permalink',
'permalinkPosition' => 'answer-top-right',
'enableSocialShare' => false,
'feedbackEnabled' => false,
'paginationEnabled' => true,
'paginationStyle' => 'numbers',
'loadMoreLabel' => 'Load More',
'enableToggleAll' => false,
'showReadMore' => false,
'readMoreText' => 'Read More',
'showAuthor' => true,
'showDate' => true,
'showCategory' => true,
],
]),
]);
$response = json_decode(curl_exec($ch), true);
curl_close($ch);
const response = await fetch('https://your-site.example/wp-json/plugixa-faq/v1/shortcodes/12', {
method: 'PUT',
headers: {
'Authorization': 'Basic ' + btoa(`admin:${process.env.WP_APP_PASSWORD}`),
'Content-Type': 'application/json',
},
body: JSON.stringify({ name: 'Shipping FAQ', config: { view: 'support-centre', categories: ['shipping'], ids: [], limit: -1, pagination: 'none', perPage: 10, orderby: 'menu_order', order: 'ASC', search: true, searchPlaceholder: '', groupByCategory: false, schema: true, darkMode: 'from_view', openFirst: false, allowMultiple: true, enablePermalinks: true, permalinkText: 'Permalink', permalinkPosition: 'answer-top-right', enableSocialShare: false, feedbackEnabled: false, paginationEnabled: true, paginationStyle: 'numbers', loadMoreLabel: 'Load More', enableToggleAll: false, showReadMore: false, readMoreText: 'Read More', showAuthor: true, showDate: true, showCategory: true } }),
});
const { data } = await response.json();
Quick Links
Share