DEV Community

kerryhank
kerryhank

Posted on

How We Handle 17 Languages with WordPress + Polylang: A Technical Deep Dive

Running a WordPress site in 17 languages taught us things no documentation covers. Here is what we learned building kkinvesting.io.

Polylang REST API Patterns

Polylang exposes language data through the WP REST API, but it is underdocumented.

# Get all posts in Japanese
GET /wp-json/wp/v2/posts?lang=ja&per_page=100

# Set language when creating a post
POST /wp-json/wp/v2/posts
{"title": "...", "lang": "ja", "translations": {"en": 123}}
Enter fullscreen mode Exit fullscreen mode

Batch Publishing Pipeline

We publish articles in batches: write the source (Traditional Chinese) → translate → localize → publish all languages. Our Python pipeline handles:

  1. Markdown to Gutenberg HTML conversion
  2. Language-specific slug generation
  3. Polylang translation linking
  4. Rank Math SEO metadata per language
  5. Cloudflare cache purging

Hard Lessons

  • PUT requests get blocked by Cloudflare — Use X-HTTP-Method-Override: PUT header
  • Rate limit your batch operations — WordPress crashes if you fire too many PUT requests
  • context=edit is expensive — Use _fields=id,status for lightweight checks
  • hreflang tags are critical — One mistake and Google ignores all translations

Full tutorials: kkinvesting.io

Top comments (0)