WPML Translation Automation Plan
Status: Planning — investigation needed before implementation Date: 2026-03-29 Context: Currently translating content manually via WPML’s Advanced Translation Editor. This plan documents three approaches to streamline the workflow, from current manual process to fully automated.
Current Workflow (Option 3 — in use now)
Section titled “Current Workflow (Option 3 — in use now)”- Claude Code translates the article content into Japanese
- Translation is saved in the same vault note as the English version (below the article body)
- All hyperlinks updated to
/ja/versions where Japanese pages exist - WordPress metadata (excerpt, SEOPress, photo captions/alt text) translated separately
- Patrick creates the Japanese post shell in WPML’s translation editor
- Patrick pastes each translated section into the corresponding WPML field
- WPML handles the language relationship linking automatically
Pros: Safe, WPML manages relationships correctly, no risk of breaking anything Cons: Manual paste step for every article, tedious for long content
Option 2 — WP-CLI Post Creation + Database Linking
Section titled “Option 2 — WP-CLI Post Creation + Database Linking”- Claude Code creates the translated post via
wp post createwith full Gutenberg block content - Manually insert the WPML translation relationship in
wp_icl_translationstable - Set
trid(translation ID) to match the English post,language_codetoja
Investigation needed:
- Query:
SELECT trid, language_code, element_id FROM wp_icl_translations WHERE element_id = {english_post_id} - Insert: match the
trid, setlanguage_code = 'ja',element_id = {new_japanese_post_id} - Risk: WPML may have additional metadata or hooks that need to fire when creating translations. Database-only linking might leave the post in an inconsistent state.
- Test on staging first (pracstage.baseworks.com)
Pros: Fully automated content creation, only DB linking is manual Cons: Fragile — WPML schema could change between versions, not officially supported
Option 1 — WPML REST API (Preferred Long-Term)
Section titled “Option 1 — WPML REST API (Preferred Long-Term)”- Check if WPML REST API is enabled:
wp option get wpml_rest_api_enabledor check WPML settings - If available, use endpoints like:
POST /wp-json/wpml/v1/translationsto create translation relationships- Or WPML’s Translation Management API
- Claude Code sends the full translated content + metadata via API, WPML handles linking
Investigation needed:
- WPML version on baseworks.com (check
wp plugin list | grep sitepress) - Whether WPML REST API endpoints are available (varies by WPML plan — may require WPML CMS or higher)
- API documentation: check WPML’s developer docs for available endpoints
- Authentication: would use the same WP REST API auth as other API calls
Pros: Clean, officially supported, fully automatable Cons: May require WPML CMS license tier, API may not cover all fields (SEOPress, ACF)
Rules for All Approaches
Section titled “Rules for All Approaches”- Japanese slugs always use the English slug:
/ja/{english-slug}/ - All baseworks.com internal links in Japanese content must point to
/ja/versions where available - Photo captions, alt text, SEOPress fields, and excerpts must all be translated
- Product names (Baseworks Primer, Smart Revisit, PrimerPrint, Practice Platform) stay in English
- Form names (Star Form, Squat, etc.) stay in English
- The “BRAIN FODDER” heading stays in English (brand element)
- Photographer credit stays in English (Andrew Miller / awesomephotography.ca)
Next Steps
Section titled “Next Steps”- SSH to baseworks.com and check WPML version + REST API availability
- If REST API is available, test with a simple page translation on staging
- If not, test Option 2 (WP-CLI + DB linking) on staging with a test post
- Document whichever approach works as a repeatable workflow or skill
Relationship to Existing Plans
Section titled “Relationship to Existing Plans”The wpml-translation-workflow document is the comprehensive implementation plan — it includes the mu-plugin code (bw-wpml-translation-api.php), vault JSON file structure for translations, REST API endpoints, Elementor/WooCommerce handling, language rollout phases, and session flow examples. That document supersedes Options 1 and 2 in this plan by providing a complete custom REST API solution.
This automation plan documents the interim approach (Option 3 — manual paste) that is in use until the mu-plugin is deployed, along with the translation rules that apply regardless of which approach is used.
Related
Section titled “Related”- wpml-translation-workflow — full implementation plan with mu-plugin code, REST endpoints, and vault file structure (the primary reference)
- wpml-migration-plan — future architecture where WPML is replaced by Cloudflare Worker (vault translation files are portable to this)