Title: [Plugin: Polylang] create Polylang compatible plugins
Last modified: August 21, 2016

---

# [Plugin: Polylang] create Polylang compatible plugins

 *  Resolved [BraveThrasher](https://wordpress.org/support/users/bravethrasher/)
 * (@bravethrasher)
 * [12 years, 4 months ago](https://wordpress.org/support/topic/polylang-create-polylang-compatible-plugins/)
 * What are the requirements for other plugins to be compatible with Polylang?
    
   For instance, what is the code needed for:
    - retrieving current language
    - retrieving available languages
 * [http://wordpress.org/plugins/polylang/](http://wordpress.org/plugins/polylang/)

Viewing 4 replies - 1 through 4 (of 4 total)

 *  Plugin Author [Chouby](https://wordpress.org/support/users/chouby/)
 * (@chouby)
 * [12 years, 4 months ago](https://wordpress.org/support/topic/polylang-create-polylang-compatible-plugins/#post-4525278)
 * The current language is obtained by the function [pll_current_language](http://polylang.wordpress.com/documentation/documentation-for-developers/functions-reference/#pll_current_language)
 * There is no currently API function to get all available languages (I have to 
   improve this). So you need to use Polylang internal function.
 *     ```
       global $polylang;
       $languages = $polylang->model->get_languages_list();
       ```
   
 * You thus get an array of `PLL_Language` objects with properties documented in
   polylang/include/language.php among those most interesting are ‘slug’ and ‘locale’.
 * If you are familiar with WPML, you can use ‘icl_get_languages’ too.
 *  Thread Starter [BraveThrasher](https://wordpress.org/support/users/bravethrasher/)
 * (@bravethrasher)
 * [12 years, 3 months ago](https://wordpress.org/support/topic/polylang-create-polylang-compatible-plugins/#post-4525344)
 * What can be the reason for `pll_current_language('slug')` to return `null`?
    
   Do I need to do something else first?
 *  Plugin Author [Chouby](https://wordpress.org/support/users/chouby/)
 * (@chouby)
 * [12 years, 3 months ago](https://wordpress.org/support/topic/polylang-create-polylang-compatible-plugins/#post-4525356)
 * The function does not return any language when the current language has not been
   set yet.
 * The current language is set very soon (‘plugins_loaded’ action) when the language
   is set from url but quite late (‘wp’ action) when it is set from content.
 * However, you may not need to bother with all the cases as Polylang fires the 
   action ‘pll_language_defined’ when the current language is set.
 *  Thread Starter [BraveThrasher](https://wordpress.org/support/users/bravethrasher/)
 * (@bravethrasher)
 * [12 years, 3 months ago](https://wordpress.org/support/topic/polylang-create-polylang-compatible-plugins/#post-4525392)
 * Thank you, Chouby! With these pointers and a little research I was able to get
   the Polylang integration in the EU Cookie Law Compliance plugin to work again.
 * [See this topic for what I did…](http://wordpress.org/support/topic/polylang-together-with-eu-cookie-law-compliance-plugin?replies=3)

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘[Plugin: Polylang] create Polylang compatible plugins’ is closed to new
replies.

 * ![](https://ps.w.org/polylang/assets/icon-256x256.png?rev=3433336)
 * [Polylang](https://wordpress.org/plugins/polylang/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/polylang/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/polylang/)
 * [Active Topics](https://wordpress.org/support/plugin/polylang/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/polylang/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/polylang/reviews/)

## Tags

 * [compatibility](https://wordpress.org/support/topic-tag/compatibility/)
 * [compatible](https://wordpress.org/support/topic-tag/compatible/)
 * [requirements](https://wordpress.org/support/topic-tag/requirements/)

 * 4 replies
 * 2 participants
 * Last reply from: [BraveThrasher](https://wordpress.org/support/users/bravethrasher/)
 * Last activity: [12 years, 3 months ago](https://wordpress.org/support/topic/polylang-create-polylang-compatible-plugins/#post-4525392)
 * Status: resolved