Skip Navigation

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 Christopher Amirian 10 months, 1 week ago.

Assigned support staff: Christopher Amirian.

Author Posts
July 9, 2021 at 1:09 pm #9165237

massimoG-5

Hi, I've a problem, get_term_by(name) don't work properly in translation if term name is the same of original language. I can fix it with a WPML function for return correct id?

$location = esc_attr($params['location']);
$term = get_term_by('name', $location, 'listing-location');
$location = $term->term_id; -> (this work only in italian)

Thanks

July 11, 2021 at 6:42 am #9171735

Christopher Amirian
Supporter

Languages: English (English )

Timezone: Asia/Yerevan (GMT+04:00)

Hi there,

This is a custom code quesiton and it is outside of our support scope. We will not be able to delve into the code details to find the issue.

But you are welcomed to check the function below which is the recommended way to get the term instead of the funciton that you use:

https://wpml.org/wpml-hook/wpml_object_id/

In general you can learn more about WPML specific hooks here:

https://wpml.org/documentation/support/wpml-coding-api/wpml-hooks-reference/

Thank you.