I am trying to: programatically get the list of all languages active ( wp_icl_languages.active = 1) using the hook "wpml_active_languages" for which documentation says : "Filters the list of the languages enabled (active) for a site. "
I have three languages, fr (main), english (active) and ar (hidden) and I use
Link to a page where the issue can be seen: site is protected behind htpassword, I can provide the credentials
I expected to see: an array with three languages
Instead, I got: an array with two languages (hidden language is missing, though there is content translated in arabic)
Ofc, I can retrieve the list of active languages with a simple query in the database, but :
- the documentation is misleading
- imho this should definitively bee a wpml function
- I don't like to code myself such basic queries as they always might break if something changes in WPML.
Please review my colleague's answer as it might help you resolve this issue regarding not being able to retrieve the hidden languages with wpml_active_languages
I'd love to, but the link sends me to a 404 (and it happens for many links to this forum that I find in Google).
I had to search this title on Google and could find the Google cached version.
1- it does the trick
2- does not change the fact that the documentation is inaccurate (as "active languages" in my understanding, include hidden languages: we can work with them, and they are set as active in the database)
3- does not change neither the fact that it would be great to have a filter from WPML to get this information, because basically, it's easier to perform one SQL query than to merge two arrays 😀