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.
Our next available supporter will start replying to tickets in about 7.72 hours from now. Thank you for your understanding.
This topic contains 4 replies, has 2 voices.
Last updated by Lauren 4 years, 6 months ago.
Assisted by: Lauren.
Author | Posts |
---|---|
April 17, 2020 at 1:24 am #5927805 | |
nicolasT-34 |
Tell us what you are trying to do? I am building a Gatsby based WordPress site and I am looking for an endpoint to retrieve all translated taxonomy term at once. Is there any documentation that you are following? Yes my work is based on this tutorial hidden link It described how to modify WP to retrieve all translated content from custom post in the REST API and it works fine thanks to this code : You can see that this end point will get all translated content (we added the wpml_current_locale variable using wpml-rest-api plugin) : However we would like to know how to do the same for taxonomies so this endpoint hidden link will display all EN & FR content in the same endpoint. Thank you very much |
April 19, 2020 at 3:14 pm #5942975 | |
Lauren Supporter
Languages: English (English ) Timezone: America/New_York (GMT-05:00) |
Hi there, thanks for contacting WPML. Can you please share the code you are currently using to display the taxonomies? For example: https://developer.wordpress.org/reference/functions/get_terms/ Per our support policy, I am not able to provide a custom code solution but I will be happy to review your existing code to see if anything stands out. I found a similar ticket here, although the issue is the opposite of yours, and this client was trying to filter by language: https://wpml.org/forums/topic/rest-api-get_terms-in-rest-api-function-returns-wrong-language/#post-3514003 Without the language parameter, it should display all languages. Please check and see if your taxonomies are set to translatable or translatable or fallback to default. |
April 19, 2020 at 3:46 pm #5943037 | |
Lauren Supporter
Languages: English (English ) Timezone: America/New_York (GMT-05:00) |
Actually, I just tested this link in a cleared browser and now I see both English and French hidden link For example |
April 22, 2020 at 8:23 pm #5971983 | |
nicolasT-34 |
Hi Lauren, Right now we rebuild the site using posts instead of taxonomies but if you have some tips about how to make WPML show terms from all languages in REST, I would appreciate it. Thanks a lot |
April 22, 2020 at 10:30 pm #5972319 | |
Lauren Supporter
Languages: English (English ) Timezone: America/New_York (GMT-05:00) |
Okay so it sounds like everything is working as expected with the way you currently have it set up - is that correct? As for the taxonomies, currently there is no way to display the list of all terms in all languages, and it will require custom programming use the get_terms function. You can see an example here: https://wpml.org/forums/topic/rest-api-get_terms-in-rest-api-function-returns-wrong-language/ However, because it requires custom programming, I don't have a full solution for you. If you need further assistance with custom programming, I would suggest contacting one of our certified partners from this link: http://wpml.org/documentation/support/wpml-contractors/ |