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.
Tagged: Bug
This topic contains 10 replies, has 2 voices.
Last updated by Waqas Bin Hasan 1 year, 10 months ago.
Assisted by: Waqas Bin Hasan.
Author | Posts |
---|---|
July 6, 2023 at 7:28 am #13955771 | |
nortech |
Hello, We have an issue when trying to update terms. from rest api. In the collection we have an example. Whenever we try to update an existing term we get error that the slug already exists, even we dont put slug on the posting json update. Any ideas why we have this issue? We cant do updates on term for that reason The error (the messages says that the slug is already been used from another term) { "update": [ { "id": 166, "error": { "code": "duplicate_term_slug", "message": "Το σύντομο όνομα “bibi-lou-en” χρησιμοποιείται ήδη από άλλον όρο.", "data": null } } ] } The collection is below { Let me know please if you need an admin account. |
July 6, 2023 at 9:13 am #13956855 | |
Waqas Bin Hasan WPML Supporter since 05/2014
Languages: English (English ) Timezone: Asia/Karachi (GMT+05:00) |
Hi, Thank you for contacting the support. Can you please explain little more about the problem? Like is the term relating to a product (I assume) or another post type, how you are creating your API request (i.e. a sample code, remember not to include any credentials) and etc. As a clue, what happens if you also include the slug? Since you are updating the term, you must have the slug already. Please note that, this is not a limitation of WPML, but rather how WordPress works. Even if you don't explicitly provide a slug in your JSON update, WordPress will automatically generate one based on the term name. If you're still encountering issues, it might be worth checking if the term you're trying to update has a translation with the same slug, as this could also cause conflicts. If this is the case, you might need to adjust the slug of the translated term to ensure uniqueness. Additionally, may I ask for the debug information of your website for an overview of your setup? See https://wpml.org/faq/provide-debug-information-faster-support/ for more information. I've enabled the debug information section for your next reply. I'll also recommend to check these relevant API docs, in case if these help: Regards. |
July 6, 2023 at 9:50 am #13957965 | |
nortech |
Hello again, Even if we provide the slug it still throws an error. The problem is on the translation too. If we do the same thing for the default language it doesnt throw an error and we can update the term as many times we want (with or without the slug) but when we do it for a translation, it throws the error |
July 6, 2023 at 12:18 pm #13959637 | |
Waqas Bin Hasan WPML Supporter since 05/2014
Languages: English (English ) Timezone: Asia/Karachi (GMT+05:00) |
Can you provide debug information of your website for an overview of your setup? See https://wpml.org/faq/provide-debug-information-faster-support/ for more information. I've enabled the debug information section for your next reply. Also, how you are creating your API request (i.e. a sample code, remember not to include any credentials) and etc. |
July 6, 2023 at 2:03 pm #13960729 | |
nortech |
API request { |
July 7, 2023 at 7:52 am #13965321 | |
Waqas Bin Hasan WPML Supporter since 05/2014
Languages: English (English ) Timezone: Asia/Karachi (GMT+05:00) |
Thank you for the updates. I discussed with the team and found that a similar case has already been escalated and is with our dev team. I've escalated this one also. Meanwhile, here's the other (similar) case, https://wpml.org/forums/topic/wpml-and-woocommernce-ap/page/2/#post-13793613, if you can take a look and perhaps may help you in the meanwhile? |
July 19, 2023 at 1:38 pm #14066697 | |
nortech |
This link doesnt help. Its for a different problem. The issue we have is with the normal update process. We dont put slug and we get an error. Its on the postman collection we send you as an example in our dev environment. Do you need something more so you can debug the issue? Plus the link you send us, is from a question we did, so we already know that reply |
July 20, 2023 at 8:17 am #14069993 | |
Waqas Bin Hasan WPML Supporter since 05/2014
Languages: English (English ) Timezone: Asia/Karachi (GMT+05:00) |
My apologies for not realizing that the other one was reported by you, however, apparently this very case looked like the same. I've requested my team for some consultation on this and 'll get back to you ASAP. |
July 20, 2023 at 11:30 am #14071787 | |
Waqas Bin Hasan WPML Supporter since 05/2014
Languages: English (English ) Timezone: Asia/Karachi (GMT+05:00) |
Thank you for your patience and cooperation. Our team suggests the following workaround: IMPORTANT: Take full backup of your website and database beforehand. 1) Please find this file "wp-content/plugins/sitepress-multilingual-cms/classes/query-filtering/class-wpml-term-query-filter.php". 2) And then find the following code: if ( ! empty( $args['slug'] ) ) { $args = $this->adjust_taxonomies_terms_slugs( $args, $taxonomies ); } 3) And replace it with: if ( ! empty( $args['slug'] ) && !wpml_is_rest_request() ) { $args = $this->adjust_taxonomies_terms_slugs( $args, $taxonomies ); } Please let me know if this fixes the problem? |
July 21, 2023 at 6:13 am #14075979 | |
nortech |
Hello. Thank you. |
July 21, 2023 at 8:48 am #14077129 | |
Waqas Bin Hasan WPML Supporter since 05/2014
Languages: English (English ) Timezone: Asia/Karachi (GMT+05:00) |
Thank you for confirming and glad it worked for you. Unfortunately there's no ETA so far, however, the issue is with dev team and is in active development. |