The Settings REST API is included with Polylang. This API provides programmatic access to manage Polylang settings through HTTP endpoints. It allows to retrieve and update various configuration options that control how Polylang handles multilingual functionality in a WordPress installation. All endpoints are accessible via /wp-json/pll/v1/settings
.
Table of Contents
Get Settings
Retrieves all current Polylang settings.
GET /wp-json/pll/v1/settings
Response Schema
Property | Type | Default | Description |
---|---|---|---|
force_lang | integer | 1 | Determines how the current language is defined. Values: 1, 2, or 3. |
domains | object | {} | Domains used when language is set from different domains. Keys are language slugs that must match the pattern ^[a-z][a-z0-9_-]*$ . Values are URIs. |
hide_default | boolean | true | Whether to remove language code in URL for default language. |
rewrite | boolean | true | Whether to remove /language/ in pretty permalinks. |
redirect_lang | boolean | false | Whether to remove page name/ID from front page URL. |
browser | boolean | false | Whether to detect preferred browser language on front page. |
media_support | boolean | false | Whether to enable media translation. |
post_types | array | [] | List of post types to translate. |
taxonomies | array | [] | List of taxonomies to translate. |
sync | array | [] | List of data to synchronize between translations. |
default_lang | string | "" | Slug of the default language (must match pattern ^[a-z][a-z0-9_-]*$ ). |
nav_menus | object | {} | Translated navigation menus configuration for each theme. |
language_taxonomies | array | [] | List of language taxonomies used for custom DB tables. |
media * | object | {"duplicate": false} | Settings for media duplication across languages. |
machine_translation_enabled * | boolean | false | Whether machine translation is enabled. |
machine_translation_services * | object | {"deepl": []} | Settings for machine translation services (DeepL API key and formality). |
version | string | "" | Current Polylang version (read-only). |
previous_version | string | "" | Previous Polylang version (read-only). |
first_activation | integer | 1738660878 | Timestamp of first Polylang activation (read-only). |
* Pro version only
Update Settings
Updates Polylang settings. Supports POST, PUT, and PATCH methods.
POST/PUT/PATCH /wp-json/pll/v1/settings
Parameters
Parameter | Type | Required | Description |
---|---|---|---|
force_lang | integer | No | Determines how the current language is defined. Values: 1, 2, or 3. |
domains | object | No | Domains used when language is set from different domains. Keys are language slugs that must match the pattern ^[a-z][a-z0-9_-]*$ . Values are URIs. |
hide_default | boolean | No | Whether to remove language code in URL for default language. |
rewrite | boolean | No | Whether to remove /language/ in pretty permalinks. |
redirect_lang | boolean | No | Whether to remove page name/ID from front page URL. |
browser | boolean | No | Whether to detect preferred browser language on front page. |
media_support | boolean | No | Whether to enable media translation. |
post_types | array | No | List of post types to translate. |
taxonomies | array | No | List of taxonomies to translate. |
sync | array | No | List of data to synchronize between translations. |
default_lang | string | No | Slug of the default language (must match pattern ^[a-z][a-z0-9_-]*$ ). |
nav_menus | object | No | Translated navigation menus configuration for each theme. |
language_taxonomies | array | No | List of language taxonomies used for custom DB tables. |
media * | object | No | Settings for media duplication. Contains duplicate boolean property. |
machine_translation_enabled * | boolean | No | Whether to enable machine translation. |
machine_translation_services * | object | No | Settings for translation services. Contains DeepL configuration with API key and formality settings. |
* Pro version only
Sync Options
The sync
parameter accepts an array of the following values:
taxonomies
post_meta
comment_status
ping_status
sticky_posts
post_date
post_format
post_parent
_wp_page_template
menu_order
_thumbnail_id
Machine Translation Service Options (Pro)
The machine_translation_services
parameter accepts a DeepL configuration object with the following properties:
api_key
: string – DeepL API key.formality
: string – Translation formality level. Values:"default"
,"prefer_more"
,"prefer_less"
.
Example Request
POST /wp-json/pll/v1/settings
{
"force_lang": 1,
"hide_default": true,
"browser": false,
"post_types": ["post", "page"],
"sync": ["post_meta", "taxonomies"],
"default_lang": "en",
"media": { /* Pro */
"duplicate": true
},
"machine_translation_enabled": true, /* Pro */
"machine_translation_services": { /* Pro */
"deepl": {
"api_key": "your-api-key",
"formality": "prefer_more"
}
}
}
Response Properties
The API returns an object containing all settings, including read-only properties.
General Remarks
- All endpoints support batch requests through the v1 batch API.
- Update endpoint requires authentication with a user that has the
manage_options
capability. - Default values are provided for all settings if not specified.
- The API enforces strict validation of parameter types and formats.
- The complete API schema is discoverable on
OPTIONS
/wp-json/pll/v1/settings
endpoint. This provides detailed information about available endpoints, methods, parameters, and their constraints.