Author Archives: Frédéric

Polylang 1.8.1

Polylang 1.8.1 is a maintenance release. The main goal is to fix a regression introduced in version 1.8 concerning secondary queries with translatable post types and non translatable taxonomies. It also fixes a few other minor bugs that I noticed while testing during the last week.

Facebook and WordPress introduced a lot of new locales during the past year. I updated accordingly the mapping between these locales used for Opengraph support when Polylang is used in conjunction with Yoast SEO or Jetpack.

Three new translations have been moved to languages packs (ca, de_DE and pt_BR). And a brand new translation was created (es_CL). Today, already 16 languages packs are available for Polylang. 27 older translations are still supplied with the plugin. Thanks a lot to the translators and translation editors for their work.

Polylang 1.8

After almost two months of beta tests, Polylang 1.8 has just been released.

As described in an earlier post, the most visible changes are in the plugin settings pages which have been totally revamped.

You are now able to choose your own flags for the languages, directly from the admin screen when adding or editing a language. The default language is now identified in the languages list table and can be modified directly in the table.

Since the last update, six new WordPress languages packs (ary, bn_BD, en_ZA, es_AR, fr_BE, fr_CA) have been created. These languages found their place in the predefined list.

The settings are now arranged in modules. One late change not earlier described is a new option to allow Polylang data not to be deleted when the plugin is uninstalled. If you want to delete all Polylang data when using the red “Delete” link in the plugins list table, you now have to check this option in the Tools module of Polylang settings. This option is unchecked by default.

The hreflang html tag now contains the locale instead of the ISO-639-1 language code. This will allow users having several variants of the same ISO-639-1 language to have valid W3C locales in the hreflang tags. Polylang also works around an issue in WordPress for non W3C valid locales (ex: de_DE_formal).

I also worked on the compatibility with Jetpack Related Posts, Duplicate Post, and worked around a bug in Nextgen Gallery preventing both plugins to work together.

Other less visible improvements and bug fixes are described in the changelog. Developpers having a plugin or a theme interacting directly with the PLL_Model class instead of the Polylang API should read the post dedicated to internal changes.

Last but not least, twelve translations are now taking profit of the plugins languages packs (automatically updated by the built in functionnality of WordPress): Albanian, Danish, Duch, French, Greek, Galician, Italian, Japanese, Portuguese, Romanian, Slovak and Swedish. Thanks a lot to the translators and translations editors!

Polylang 1.8 beta 2

I just uploaded a new development version of Polylang (1.8 beta 2). It fixes a few bugs, two of them being reported on the support forum:

  • Non alphanumeric characters query vars values lead to an infinite redirection loop on the static front page
  • The user profile is not saved for a language when the language code contains a “-“

It also fixes a conflict with the plugin Duplicate Post as translations were duplicated when they should not.

I also started removing po/mo files for translations being available as languages packs from the Translate WordPress project. This will allow automatic updates for these translations (once Polylang 1.8 will be released). At the time I write these lines, 9 languages packs are already available thanks to Polylang translations editors and global editors who did a fantastic job:

  • Albanian thanks to Besnik, global editor
  • Italian thanks to Luca Barbetti, Polylang translation editor
  • Japanese thanks to Eiko Toda, Polylang translation editor
  • French thanks to fxbenard, global editor
  • Galician thanks to the global editor
  • Portuguese, thanks to the global editor
  • Romanian thanks to Philippe C. Focsaneanu, Polylang translation editor
  • Slovak thanks to Maros Kucera, Polylang translation editor
  • Swedish thanks to Jon Täng, Polylang translation editor

Contributing a translation is very easy. Please visit the Translate WordPress website. If you want to join the team of translation editors for Polylang, just leave a comment below.

Polylang 1.8 for the developpers

As announced with the beta version, Polylang 1.8 will include several changes under the hood.

This version will introduce two new API functions, pll_get_post_translations() and pll_get_term_translations(), and a new WPML compatibility API function, wpml_get_language_information(). Note that all API are now available only once the action ‘plugins_loaded’ has been fired (they were available as soon as Polylang was loaded in previous versions).

When possible it is preferrable to use the API functions. This offers you the assurance that your plugin won’t break at Polylang update. However if for some reasons you need to interact with Polylang at low level, the function PLL() has been introduced to access the global Polylang object.

The most important for third party plugins interacting at low level with Polylang are the changes to the PLL_Model class. Posts and terms related methods have been moved to their own class. Here is an exhaustive list of methods removed from PLL_Model and examples of how to replace them:


Apply the same method to PLL_Model::$post or PLL_Model::$term:

Old:	$polylang->model->get_object_term( $object_id, $taxonomy )
New:	PLL()->model->post->get_object_term( $object_id, $taxonomy )
	PLL()->model->term->get_object_term( $object_id, $taxonomy )


Apply the same method to PLL_Model::$post or PLL_Model::$term and remove the ‘post’ or ‘term’  argument:

Old:	$polylang->model->save_translations( ‘post’, $id, $translations )
	$polylang->model->save_translations( ‘term’, $id, $translations )
New:	PLL()->model->post->save_translations( $id, $translations )
	PLL()->model->term->save_translations( $id, $translations )


Remove ‘_post’ from the method name and apply it to PLL_Model::$post

Old:	$polylang->model->set_post_language($post_id, $lang )
New:	PLL()->model->post->set_language($post_id, $lang )


Remove ‘_term’ from the method name and apply it to PLL_Model::$term

Old:	$polylang->model->set_term_language($term_id, $lang )
New:	PLL()->model->term->set_language($term_id, $lang )

Nothing should break as I introduced backward compatibility with the magic method __call(), however Polylang will trigger an error message when WP_DEBUG is set to true. There is no warranty that I will keep this magic method in the future.

Some other changes were done (for example, in the management of the static front pages) but I guess that these should have no impact for third party plugins. Anyway, it’s still better to use the beta period to test your theme(s) or plugin(s) against this new version.

For those, interacting directly at database level, no change was made in the way Polylang manages its data.

Polylang 1.8 beta

I am glad to announce the availability of the beta version of Polylang 1.8.

The most visible changes are in the settings of Polylang. Indeed it is now possible to select the flag for each language directly from the admin interface.  Almost 250 flags are available. They are used on both admin and frontend side. However, it is still possible to use your own custom flags on frontend by putting them in the wp-content/polylang folder as before.

I totally revamped the settings tab. Choosing the default language or assigning this default language to the existing content is now done directly in the languages tab. Other options are now grouped by modules in a list table. This new interface mixes concepts from the plugins list table and the posts quick edit.

Advanced media users should be happy as I improved the compatibility with third party plugins using media taxonomies and custom fields. Indeed it is now possible to synchronize media taxonomies and custom fields as it was already the case for posts.

I attempted to work around an old bug in NextGen Gallery which prevents both plugins to work together. Although, a user proposed a fix, Nextgen Gallery has not been updated yet and I decided to include a workaround proposed by the Photocrati team. You might consider that it was a long time to wait, but this change is a bit risky and that’s the reason why I needed to wait for a major version. Hopefully Nextgen Gallery will fix its own bug in the future, as it’s always better to solve a problem at the source.

I also introduced a workaround for some WordPress locales which are not valid according to the W3C. Polylang will now automatically output the correct locale in the html source instead of the wrong one, normally outputed by WordPress.

A lot of changes occured under the hood. These changes could impact how third party plugins interact with Polylang. I will detail them in a separate post dedicated to developpers.

Polylang 1.8 includes a few other minor changes and fixes a lot of bugs detailed in the changelog.

There are a lot of new strings (most of them being country names). As explained a few days ago, translations of Polylang are now managed on Translating WordPress. A positive effect is that a lot of the new strings have already been automatically translated and validated for major languages (probably taken from other projects). It’s very easy to help translating in your own language.

My plan is to release the final version in January. Don’t hesitate to download Polylang 1.8 beta, test it and report bugs in the support forum. Thanks!