This may be a rare case, but if you call the get_terms(); function to retrieve a custom taxonomy array, and you are using the WPML (WordPress Multilingual) plugin for language translation, there is an undocumented (see below) argument that you will need to use.
If, for example, your custom taxonomy, “Birds,” has a the following terms: hummingbird, sparrow, dove, crow, parrot, hawk. You can use WPML to add Spanish translations: colibrí, gorrión, paloma, cuervo, loro, halcón. To display a list of the birds taxonomy, you would call:
$terms = get_terms('birds');
$count = count($terms);
if ($count > 0) {
$bird_list = '<ul class="birds-list">';
foreach ($terms as $term) {
$bird_list .= '<li>' . $term->name . '</li>';
}
$bird_list .= '</ul>';
echo $bird_list;
}
/****************************************
Regardless of which language is selected, this snippet will display:
colibrí
crow
cuervo
dove
gorrión
halcón
hawk
hummingbird
loro
paloma
parrot
sparrow
*/
Continue reading →