I am making an plugin, and inside my admin page (Which i add by add_menu_page() function) i call this function pll_the_languages(["raw" => 1])) but its return nothing,on client side its work fine. I added many languages on Polylang setting page. How can i get Polylang available languages from an admin page ?

  • 1
    you can try that : if (isset($GLOBALS["polylang"])) { $arrayLanguages = $GLOBALS["polylang"]->model->get_languages_list(); }
    – mmm
    Commented Jun 15, 2018 at 21:34
  • Polylang and other 3rd party plugin dev support questions are offtopic and not in this stacks scope.
    – Tom J Nowell
    Commented Feb 23, 2022 at 15:50

3 Answers 3


According to Polylangs Function Reference, pll_the_languages

Displays a language switcher.

And most probably it uses some additional CSS/JS to work. If you want to get the list of languages and display them with your custom code, then you can use this function instead:


and it will return the list of languages.

$args is an optional array parameter. Options are:

  • ‘hide_empty’ => hides languages with no posts if set to 1 (default: 0)
  • ‘fields’ => returns only that field if set. Possible values are ‘slug’, ‘locale’, ‘name’, defaults to ‘slug’
  • 1
    pll_the_languages returns an empty string in wp-admin.
    – alpipego
    Commented Aug 21, 2019 at 10:32

You can get an array with the language details using the following call:

if (function_exists('pll_languages_list')) {
    return pll_languages_list(array('fields' => array()));

The result is an array which you can play with to your liking...

term_id: 19,
name: "English",
slug: "en",
term_group: 0,
term_taxonomy_id: 19,
taxonomy: "language",
description: "en_US",
parent: 0,
count: 149,
tl_term_id: 20,
tl_term_taxonomy_id: 20,
tl_count: 35,
locale: "en_US",
is_rtl: 0,
w3c: "en-US",
facebook: "en_US",
flag_url: "http://***********.one/wp-content/plugins/polylang/flags/us.png",
flag: "<img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAALCAIAAAD5gJpuAAAABGdBTUEAAK/INwWK6QAAABl0RVh0U29mdHdhcmUAQWRvYmUgSW1hZ2VSZWFkeXHJZTwAAAHzSURBVHjaYkxOP8IAB//+Mfz7w8Dwi4HhP5CcJb/n/7evb16/APL/gRFQDiAAw3JuAgAIBEDQ/iswEERjGzBQLEru97ll0g0+3HvqMn1SpqlqGsZMsZsIe0SICA5gt5a/AGIEarCPtFh+6N/ffwxA9OvP/7//QYwff/6fZahmePeB4dNHhi+fGb59Y4zyvHHmCEAAAW3YDzQYaJJ93a+vX79aVf58//69fvEPlpIfnz59+vDhw7t37968efP3b/SXL59OnjwIEEAsDP+YgY53b2b89++/awvLn98MDi2cVxl+/vl6mituCtBghi9f/v/48e/XL86krj9XzwEEEENy8g6gu22rfn78+NGs5Ofr16+ZC58+fvyYwX8rxOxXr169fPny+fPn1//93bJlBUAAsQADZMEBxj9/GBxb2P/9+S/R8u3vzxuyaX8ZHv3j8/YGms3w8ycQARmi2eE37t4ACCDGR4/uSkrKAS35B3TT////wADOgLOBIaXIyjBlwxKAAGKRXjCB0SOEaeu+/y9fMnz4AHQxCP348R/o+l+//sMZQBNLEvif3AcIIMZbty7Ly6t9ZmXl+fXj/38GoHH/UcGfP79//BBiYHjy9+8/oUkNAAHEwt1V/vI/KBY/QSISFqM/GBg+MzB8A6PfYC5EFiDAABqgW776MP0rAAAAAElFTkSuQmCC" title="English" alt="English" width="16" height="11" style="width: 16px; height: 11px;" />",
home_url: "http://**********.one/en/front-page-2/",
search_url: "http://*********.one/en/",
host: null,
mo_id: "1716",
page_on_front: 2560,
page_for_posts: 499,
filter: "raw",
flag_code: "us"

Polylang offers the function pll_languages_list() but note this will return only one type of value slug.

You can use get_terms to query all languages with the name and slug included.

get_terms( 'term_language', [ 'hide_empty' => false ] );

Not the answer you're looking for? Browse other questions tagged or ask your own question.