This is the technical support forum for WPML - the multilingual WordPress plugin.

Everyone can read, but only WPML clients can post here. WPML team is replying on the forum 6 days per week, 22 hours per day.

This topic contains 1 reply, has 2 voices.

Last updated by Riffaz 1 year, 2 months ago.

Assigned support staff: Riffaz.

Author Posts
March 11, 2019 at 3:22 am #3307529


Tell us what you are trying to do?
Use the get_categories() function to get a list of the categories in the current language (the get_categories function is being called from functions.php)

Is there any documentation that you are following?

Is there a similar example that we can see?
Currently get_categories() returns all categories from all languages.

What is the link to your site?
hidden link
(see 'select specialty dropdown)

March 11, 2019 at 6:35 am #3307929


Languages: English (English )

Timezone: Asia/Colombo (GMT+05:30)


Thank you for contacting WPML support.

You could try this:

Just use this action before your get_categories and this will switch language to the given one and get_categories will return results in only one language.

If you use it, don't forget to switch back to original language after getting categories. You should store original language before whole process and then use it. To obtain this language you can use filter


If this does not help and get_categories would still retrun all language results, you could try to post-process list of categories: iterate all categories, check its language with one of those filters:

and compare if this is what you want.

I hope this helps you ???? In case if you want to know whole WPML api hooks, here it is: