Support Log in

27. WP-CLI Commands

Developer Guide
Prefer video? Watch the Lang Forge tutorials 9 short guides covering every feature Watch

All commands are under the wp langforge namespace. These commands are essential for managing translations in bulk, automating deployment workflows, and scripting translation processes.

wp langforge status

Show translation status overview with post counts per language and completion percentages.

bash
$ wp langforge status
+------+---------+-------+---------+
| Code | Language | Posts | Default |
+------+---------+-------+---------+
| ru   | Русский  | 45    | Yes     |
| en   | English  | 38    |         |
| de   | Deutsch  | 12    |         |
+------+---------+-------+---------+
Flags:
FlagDescriptionDefault
--formatOutput format: table, json, csvtable

wp langforge languages

List all active languages with their configuration details.

bash
$ wp langforge languages
+------+---------+---------+--------+---------+
| Code | Name    | Native  | Locale | Default |
+------+---------+---------+--------+---------+
| ru   | Russian | Русский | ru_RU  | *       |
| en   | English | English | en_US  |         |
+------+---------+---------+--------+---------+

wp langforge translate

Create a translation copy of a post in the specified language.

bash
$ wp langforge translate 42 en
Success: Created translation #99 (en) for post #42.
Arguments:
ArgumentDescription
Source post ID
Target language code
Flags:
FlagDescriptionDefault
--statusPost status for new translationdraft
bash
# Batch translate: create English versions for all Russian posts
$ wp post list --meta_key=_lf_language --meta_value=ru --format=ids | 
  xargs -I{} wp langforge translate {} en

wp langforge set-language

Set or change the language of an existing post.

bash
$ wp langforge set-language 42 ru
Success: Set language 'ru' for post #42.

# Bulk set language for all posts without a language
$ wp post list --meta_key=_lf_language --meta_compare='NOT EXISTS' --format=ids | 
  xargs -I{} wp langforge set-language {} ru

wp langforge link

Link two existing posts as translations of each other.

bash
$ wp langforge link 42 99
Success: Linked posts #42 and #99 as translations.

wp langforge unlink

Remove a translation link. This does not delete the target post.

bash
$ wp langforge unlink 42 en
Success: Unlinked en translation from post #42.

wp langforge tm-populate

Populate Translation Memory from all existing translations (PRO).

bash
$ wp langforge tm-populate
Populating Translation Memory from existing translations...
Processing 150 translation groups...
Success: Added 342 segments to Translation Memory.

wp langforge export

Export translations to XLIFF or CSV format.

bash
# Export to XLIFF (default)
$ wp langforge export --lang=en --format=xliff --output=export-en.xliff
Success: Exported 42 posts to export-en.xliff

# Export to CSV
$ wp langforge export --lang=de --format=csv --output=export-de.csv
Success: Exported 42 posts to export-de.csv
Flags:
FlagDescriptionDefault
--langTarget language code (required)
--formatxliff or csvxliff
--outputOutput file pathauto
--post_typeFilter by post typeall
--statusFilter by post statuspublish

wp langforge import

Import translations from an XLIFF or CSV file.

bash
$ wp langforge import translations.xliff
Success: Imported 156 translations.

wp langforge flush

Flush WordPress rewrite rules.

bash
$ wp langforge flush
Success: Rewrite rules flushed.

Scripting Examples

bash
# Complete deployment script: set up translations on a new site
#!/bin/bash

# 1. Check status
wp langforge status

# 2. Set language for all unassigned content
wp post list --meta_key=_lf_language --meta_compare='NOT EXISTS' --format=ids | 
  xargs -I{} wp langforge set-language {} ru

# 3. Create English translations for all Russian posts
wp post list --meta_key=_lf_language --meta_value=ru --post_type=post --format=ids | 
  xargs -I{} wp langforge translate {} en

# 4. Flush rewrite rules
wp langforge flush

# 5. Verify
wp langforge status

Forge AI Assistant Online

Hi! I'm the Lang Forge AI assistant. Ask me anything about the plugin — setup, features, troubleshooting, or development.

Just now
Powered by Forge AI · Browse docs