Exciting news! The Beta1 version of Polylang Pro 3.7 is now available for download from your Polylang account. Take all the time you need to test this version before the stable one is released.
Spoiler alert: this update brings new endpoints, changes to Polylang options, enhanced ACF Pro integration, and significant improvements for DeepL machine translation.
Let’s dive into the main changes!
1. Polylang options now managed as object
Polylang has transitioned from storing options in a simple PHP array to using an array-like object structure. While this change remains invisible to end users, developers working with Polylang or building third-party integrations should take note.
What does this mean for developers?
If you’re a developer using Polylang options, be aware that options are no longer stored as an array but as an object. Limited backward compatibility has been ensured, but some operations will no longer work as before, namely:
- Validation & strong typing: All options are automatically validated and sanitized, ensuring consistent and reliable data.
- Automatic saves in the database: No need to use update_option() anymore—every change is automatically saved on the shutdown hook. Consequently, get_option() and update_option() should no longer be used to manage Polylang options.
⚠️ Warning: Custom keys are no longer supported. If your custom development previously added custom keys to the Polylang options array, they will now be removed immediately. We support custom keys in our options only if the developer properly registers them through our options, which are now “managed as objects. |
2. Creation of a new endpoint
In WordPress, an endpoint is a specific URL that allows applications to send and receive data, typically through the REST API.
With Polylang 3.7, a new “settings” endpoint (/wp-json/pll/v1/settings)” has been introduced. This endpoint enables users to update and retrieve Polylang options, manage all language settings from Languages > Settings, modify the default language, and adjust menu locations—all through the API.
3. Languages endpoint now available in Polylang REST API
The language endpoint (/wp-json/pll/v1/languages) is now available in Polylang API. Previously exclusive to Polylang Pro, you can now list, create, update, and delete any language using Polylang.
4. Improved compatibility and integration with ACF Pro
Polylang Pro 3.7 takes ACF Pro integration to the next level, offering a better translation experience.
⚠️ Important: This integration works only with Polylang Pro and ACF Pro. |
Full support for ACF Block, including machine translation and XLIFF
ACF Blocks are now fully supported and managed like any other block in WordPress. This ensures they can be exported or translated with DeepL (machine translation) or XLIFF.
Post types and taxonomies from ACF Pro: now available in the Translations table
Any post types or taxonomies created with ACF Pro are now fully internationalized and included in the string Translations table.
Full support for ACF Layout Fields
Polylang Pro 3.7 fully supports Flexible Content, Repeater, Group, Clone, Tab, and Accordion fields, fixing several layout-related issues. This was the main driving force behind this significant update with ACF Pro. Numerous bugs affected these Layout field types, and we aimed to fix them all while ensuring a more stable and seamless integration with ACF Pro.
Changes to Field Groups translation
- Field Groups are no longer translatable:
Previously, if you translated Field Groups, you had a separate group per language. After updating to 3.7, the language column and language metabox will disappear. However, the language of each Field Group is still retained and will be assigned using ACF Pro’s “Location Rules.”
- Field Group locations per language:
You can now assign Field Groups to specific languages for more precise content management. To do this in ACF Pro, go to the “Locations” section of the Field Group and select “Language” as the location rule. Then, choose the desired language for that field group.
- Translatable Field Group Strings:
Labels, descriptions, and default values are now translatable via the Translations table. You now have two options when creating new Field Groups:
- Use a single Field Group for all languages and translate its labels, instructions, and default values in the Translations table (recommended for easier management).
- Continue creating a separate Field Group per language using the Language-Location Rule.
No impact on existing sites
If your site already has fully configured ACF field groups, there’s no need to worry; there is nothing to do on your site. The upgrade to version 3.7 includes a migration process that automatically converts translated field groups into ones with the correct language locations.
5. Introducing the Translate_once feature
Since Polylang Pro 2.7, you can fine-tune how your ACF Pro fields behave when creating translations for your posts, including pages and custom post types. This allows you to choose whether the value of your ACF field is ignored, copied once, translated, or synchronized when creating the translation of a post with the ACF field set. You can make this choice directly in the ACF field settings under the Translation option, as outlined in our documentation here: Working with ACF Pro
With Polylang Pro 3.7, a new option has been introduced: translate_once.
This option combines the behaviors of copy_once and translate. When a translation is created via DeepL, XLIFF, or the Polylang Translations interface, the field is translated once but will not update if the original source value changes later.
In other words, the initial translation is generated, but it remains independent of future modifications to the source field. Future updates to the source field will not sync automatically.
6. One-Click automatic translation for strings in the Translations table
With Polylang 3.7, you can now translate all your strings in the Translations table with DeepL machine translation in just one click.
Here’s how to use the machine translation from the Polylang Translations interface:
- Go to Languages > Translations and scroll down to the Machine translation section right next to the export/import strings translation options.
- Select the target language by simply ticking the box.
- (Optional) Filter by groups if you want to auto-translate specific content (e.g., WooCommerce). Leave it unfiltered to translate everything.
- Click the Translate button to translate the content automatically.
Conclusion
Before testing the update, back up your site or use a local environment! If you encounter issues or have questions, please open a support ticket. Your feedback is invaluable in ensuring the stable version is polished and ready for all users. Thank you so much for helping us shape Polylang and happy testing!
Picture illustrating the article by Couleur and licensed under the Pixabay license.