Contents
On this page

Duplicate Shortcode - Plugixa FAQ

POST /plugixa-faq/v1/shortcodes/{id}/duplicate

Copy a saved shortcode. The copy is named “ (Copy)” and gets its own slug and id.

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

Request

POST https://your-site.example/wp-json/plugixa-faq/v1/shortcodes/12/duplicate

Path parameters

Name Type Description
id integer The shortcode to copy’s id

Responses

200 OK. data.id is the copy.

{
  "success": true,
  "message": "Shortcode duplicated successfully",
  "data": {
    "id": 13
  }
}
Field Type Meaning
data.id integer The copy’s id
message string A human-readable confirmation, translated to the site language

Errors

Status Code When
404 rest_error No shortcode with that id.
500 rest_error The database refused the row.

Plus the errors every endpoint can return.

Examples

curl -s -X POST "https://your-site.example/wp-json/plugixa-faq/v1/shortcodes/12/duplicate" \
  -u "admin:$WP_APP_PASSWORD"
<?php
$ch = curl_init('https://your-site.example/wp-json/plugixa-faq/v1/shortcodes/12/duplicate');
curl_setopt_array($ch, [
    CURLOPT_CUSTOMREQUEST  => 'POST',
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_USERPWD        => 'admin:' . getenv('WP_APP_PASSWORD'),
]);
$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/duplicate', {
  method: 'POST',
  headers: {
    'Authorization': 'Basic ' + btoa(`admin:${process.env.WP_APP_PASSWORD}`),
  },
});
const { data } = await response.json();

Quick Links

Share