Contents
On this page
Link Translations - Plugixa Testimonial
PUT /plugixatestimonial/v1/multilingual/{entity}/link-translations
Make two existing items translations of each other.
Any signed-in user with the plugixa_testimonial_edit capability or WordPress’s edit_posts (Contributors and up, by default).
Note. The target joins the source’s group and leaves its own, without bringing its other translations along. The group is not checked for a row already in the target’s language. These routes work whether or not WPML or Polylang is active.
Request
PUT https://your-site.example/wp-json/plugixatestimonial/v1/multilingual/testimonials/link-translations
Path parameters
| Name | Type | Description |
|---|---|---|
entity |
string |
testimonials, categories or custom-fields |
Request body
Content type: application/json
| Field | Type | Required | Description |
|---|---|---|---|
source_id |
integer |
Yes | The item whose group is kept. |
target_id |
integer |
Yes | The item that joins it. Must be in another language. |
{
"source_id": 42,
"target_id": 61
}
Responses
200 OK.
{
"success": true,
"message": "Items linked as translations.",
"data": {
"translation_group": "3f6c1a52-9d2e-4b7a-8c51-0e4f2d9b7a16"
}
}
| Field | Type | Meaning |
|---|---|---|
data.translation_group |
string |
The shared group |
message |
string |
A human-readable confirmation, translated to the site language |
Errors
| Status | Code | When |
|---|---|---|
400 |
rest_error |
“Invalid entity type.”, or “Cannot link items with the same language.” |
404 |
rest_error |
“One or both items not found.” |
400 |
rest_missing_callback_param |
source_id or target_id is missing. |
Plus the errors every endpoint can return.
Examples
curl -s -X PUT "https://your-site.example/wp-json/plugixatestimonial/v1/multilingual/testimonials/link-translations" \
-u "admin:$WP_APP_PASSWORD" \
-H "Content-Type: application/json" \
-d '{"source_id":42,"target_id":61}'
<?php
$ch = curl_init('https://your-site.example/wp-json/plugixatestimonial/v1/multilingual/testimonials/link-translations');
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([
'source_id' => 42,
'target_id' => 61,
]),
]);
$response = json_decode(curl_exec($ch), true);
curl_close($ch);
const response = await fetch('https://your-site.example/wp-json/plugixatestimonial/v1/multilingual/testimonials/link-translations', {
method: 'PUT',
headers: {
'Authorization': 'Basic ' + btoa(`admin:${process.env.WP_APP_PASSWORD}`),
'Content-Type': 'application/json',
},
body: JSON.stringify({ source_id: 42, target_id: 61 }),
});
const { data } = await response.json();
Quick Links
Share