This thread is resolved. Here is a description of the problem and solution.
Problem:
If you're experiencing issues with the
get_terms
function returning an empty array for translated terms in a multilingual setup using WPML, consider following.
Solution:
Firstly, ensure you're using the correct syntax for the
get_terms
function. Since WordPress 4.5.0, taxonomies should be passed via the 'taxonomy' argument in the
$args
array. Here's an example of how to use it correctly:
$terms = get_terms( array( 'taxonomy' => 'post_tag', 'hide_empty' => false, ) );
Next, consider reviewing the following resources for additional guidance:
- WPML forum discussion on getting translated terms
- WPML forum discussion on correlating translated and base language terms
Also, take a look at the WPML Hooks Reference for additional hooks and examples that might be helpful, especially the
wpml_get_element_translations
hook.
If these suggestions do not resolve your issue, and you're not comfortable with custom coding, you might want to consider hiring a developer. You can find qualified contractors at https://wpml.org/contractors/.
Please note that the solution provided might be outdated or not applicable to your case. If the issue persists, we highly recommend checking related known issues at https://wpml.org/known-issues/, verifying the version of the permanent fix, and confirming that you have installed the latest versions of themes and plugins. If you still need assistance, please don't hesitate to open a new support ticket with us.
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 2 years, 9 months ago.
Assisted by: Waqas Bin Hasan.