Polylang > Support > Developers > Polylang CLI

Polylang CLI

Polylang Pro

Polylang Pro 3.8 adds custom WP-CLI commands, allowing you to manage languages and settings directly from the terminal. Whether you’re scripting deployments, syncing environments, or automating your workflow, these commands are designed to make your life easier.

Two command groups are available:

  • wp pll language — Create, list, get, update, and delete languages.
  • wp pll setting — Get, set, add, remove, and reset Polylang settings.

Run commands from your WordPress root (where wp-config.php is located), or use:

wp --path=/path/to/wordpress

These commands require Polylang Pro to be active.

wp pll language

Manage your site’s languages from the command line.

create

Add a new language to your Polylang Pro setup. Use a WordPress locale and optionally override name, slug, flag, and direction.

Synopsis:

wp pll language create <locale> [--name=<name>] [--slug=<slug>] [--flag=<flag>] [--dir=<dir>] [--order=<order>] [--skip-default-cat]

Arguments:

ArgumentDescription
<locale>WordPress locale or custom locale (e.g., en_US, fr_FR). If the locale is not in the core languages list, you must provide --name, --slug, --flag, and --dir.

Options:

OptionDescriptionDefault
--name=<name>Display name. If omitted, taken from Polylang’s core languages list.
--slug=<slug>Language slug (ideally ISO 639-1, 2 letters). Must be unique.From core list
--flag=<flag>Country code for the flag.From core list
--dir=<dir>Text direction: ltr or rtl.ltr
--order=<order>Display order (integer).0
--skip-default-catDo not create the default category for this language.

Examples:

# Create from locale only (uses core languages list)
wp pll language create en_US

# Custom name and slug
wp pll language create en_US --name="English" --slug=en

# French with flag and order
wp pll language create fr_FR --name="Français" --slug=fr --flag=fr --order=1

# RTL language (e.g. Arabic)
wp pll language create ar --dir=rtl --order=2

# Without default category
wp pll language create es_ES --name="Español" --slug=es --skip-default-cat

list

See all configured languages at a glance. Filter by slug or choose which fields to output (table, JSON, YAML, CSV).

Synopsis:

wp pll language list [--<field>=<value>] [--fields=<fields>] [--field=<field>] [--format=<format>]

Options:

OptionDescriptionDefault
--<field>=<value>Filter by one or more fields (e.g., --slug=en,fr).
--fields=<fields>Comma-separated list of fields to show.All default fields
--field=<field>Show a single field per language.
--format=<format>Output format: table, json, yaml, csv.table

Default fields: name, slug, locale, term_id, order, direction, active, default
Optional fields: w3c, facebook, host, page_on_front, page_for_posts, flag_code, fallbacks

Examples:

# List all languages
wp pll language list

# Filter by slugs
wp pll language list --slug=en,fr,es

# Display only specific columns
wp pll language list --fields=name,slug,locale

get

Retrieve a single language by its ID or slug for scripts or quick lookups.

Synopsis:

wp pll language get <id-or-slug> [--fields=<fields>] [--field=<field>] [--format=<format>]

Arguments:

ArgumentDescription
<id-or-slug>Language term ID or slug.

Options: same as list for --fields, --field, and --format.

Examples:

wp pll language get en
wp pll language get 1

update

Change an existing language’s name, locale, slug, direction, order, or flag without using the admin interface.

Synopsis:

wp pll language update <id-or-slug> [--name=<name>] [--locale=<locale>] [--slug=<slug>] [--dir=<dir>] [--order=<order>] [--flag=<flag>]

Arguments:

ArgumentDescription
<id-or-slug>ID or slug of the language to update.

Options:

OptionDescription
--name=<name>Display name.
--locale=<locale>WordPress locale (wrong value prevents .mo files from loading).
--slug=<slug>New slug (must be unique).
--dir=<dir>Text direction: ltr or rtl.
--order=<order>Display order.
--flag=<flag>Country code for the flag.

Examples:

# Update language name
wp pll language update en --name="English (US)"

# Update French language with locale, flag, and order
wp pll language update fr --name="Français" --locale=fr_FR --flag=fr --order=1

# Change slug
wp pll language update en --slug=en_us

# Change direction to RTL
wp pll language update ar --dir=rtl

# Change display order
wp pll language update es --order=3

delete

Remove a language from your configuration. Use with care: this affects content linked to that language. Add --yes in scripts to skip the confirmation prompt.

Arguments:

ArgumentDescription
<id-or-slug>ID or slug of the language to delete.

Options:

OptionDescription
--yesSkip the confirmation prompt.

Examples:

# Delete language with confirmation
wp pll language delete en

# Delete language without prompt (for scripts)
wp pll language delete en --yes

wp pll setting

Read and modify Polylang options directly. Useful for provisioning, backups, or keeping environments in sync.

set

Set a single Polylang setting (string, boolean, or integer). For list or map settings, pass a JSON value.

Synopsis:

wp pll setting set <key> <value>

Arguments:

ArgumentDescription
<key>The setting key.
<value>The value. Use a JSON string for list or map settings (e.g., '{"fr":"example.fr"}').

Examples:

# Boolean settings
wp pll setting set media_support true
wp pll setting set media_duplicate true

# Map setting (e.g. domains) as JSON
wp pll setting set domains '{"fr":"example.fr"}'

# List setting (e.g. add a post type to translatable post types)
wp pll setting set post_types '["custom_post_type","another_custom_post_type"]'

get

Inspect one or more settings, or dump everything. Output in table, JSON, YAML, or CSV format to fit your workflow.

Synopsis:

wp pll setting get [--keys=<keys>] [--format=<format>]

Options:

OptionDescriptionDefault
--keys=<keys>Comma-separated list of setting keys to get.all
--format=<format>Output format: table, json, yaml, csv.table

Examples:

# List all settings
wp pll setting get

# Get specific settings
wp pll setting get --keys=media_support,force_lang

add

Append a value to a list setting (e.g., a new translatable post type) or add a key/value pair to a map setting (e.g., a language domain).

Synopsis:

wp pll setting add <key> <value> [<subvalue>] [--yes]

Arguments:

ArgumentDescription
<key>Setting key (must be a list or map type).
<value>For a list: the value to add. For a map: the subkey to add.
<subvalue>For a map only: the value for subkey. Omit for list settings.

Options:

OptionDescription
--yesAnswer yes to confirmation prompt (e.g., when overriding an existing map key).

Examples:

# List: add a post type to translatable post types
wp pll setting add post_types custom_post_type

# Map: add a domain (key = en, value = example.com)
wp pll setting add domains en example.com

remove

Remove one entry from a list or map setting—for example, drop a post type from translation or a domain from the map.

Synopsis:

wp pll setting remove <key> <value>

Arguments:

ArgumentDescription
<key>Setting key (must be a list or map type).
<value>For a list: the value to remove. For a map: the subkey to remove.

Examples:

# List: remove a post type
wp pll setting remove post_types custom_post_type

# Map: remove a domain by key
wp pll setting remove domains en

reset

Restore one or more settings to defaults, or reset the whole Polylang configuration. Confirmation is required unless --yes is used.

Synopsis:

wp pll setting reset [--keys=<keys>] [--yes]

Options:

OptionDescription
--keys=<keys>Comma-separated list of keys to reset. If omitted, all settings are reset.
--yes
Skip the confirmation prompt when resetting all settings.

Examples:

# Reset specific settings
wp pll setting reset --keys=media_support,force_lang

# Reset all settings (prompts for confirmation)
wp pll setting reset

# Reset all without prompting (e.g. in scripts)
wp pll setting reset --yes