REST endpoints for managing post translation relationships.
GET /langforge/v1/translations/{post_id}
Get all translations for a specific post, including edit links and status.
Permission:edit_posts
Request:
bash
curl -s "https://example.com/wp-json/langforge/v1/translations/42"
-u "admin:XXXX XXXX XXXX XXXX XXXX XXXX"json
{
"post_id": 42,
"language": "ru",
"translations": {
"en": {
"id": 99,
"title": "About Us",
"status": "publish",
"edit_link": "https://example.com/wp-admin/post.php?post=99&action=edit",
"permalink": "https://example.com/en/about/"
},
"de": {
"id": 155,
"title": "Uber uns",
"status": "draft",
"edit_link": "https://example.com/wp-admin/post.php?post=155&action=edit",
"permalink": "https://example.com/de/about/"
}
}
}POST /langforge/v1/translations
Create a translation link between two existing posts.
Permission:edit_posts
Request:
bash
curl -s -X POST "https://example.com/wp-json/langforge/v1/translations"
-u "admin:XXXX XXXX XXXX XXXX XXXX XXXX"
-H "Content-Type: application/json"
-d '{
"post_id": 42,
"target_post_id": 99,
"language": "en"
}'| Parameter | Type | Required | Description |
|---|---|---|---|
post_id | integer | Yes | Source post ID |
target_post_id | integer | Yes | Target post ID to link as translation |
language | string | Yes | Language code for the target post |
json
{
"success": true,
"message": "Translation linked"
}DELETE /langforge/v1/translations/{post_id}/{lang}
Remove a translation link. This does not delete the target post, only removes the association.
Permission:edit_posts
Request:
bash
curl -s -X DELETE "https://example.com/wp-json/langforge/v1/translations/42/en"
-u "admin:XXXX XXXX XXXX XXXX XXXX XXXX"json
{
"success": true,
"message": "Translation unlinked"
}—