Skip to content Skip to sidebar

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.

Sun Mon Tue Wed Thu Fri Sat
- 8:00 – 13:00 9:00 – 13:00 9:00 – 13:00 8:00 – 12:00 8:00 – 12:00 -
- 14:00 – 17:00 14:00 – 18:00 14:00 – 18:00 13:00 – 17:00 13:00 – 17:00 -

Supporter timezone: Europe/Zagreb (GMT+02:00)

This topic contains 7 replies, has 2 voices.

Last updated by Bruno Kos 3 years, 4 months ago.

Assisted by: Bruno Kos.

Author Posts
March 2, 2022 at 11:48 am #10696457

pauli-7

I am trying to: update a term using wp_update_term and it returns:
"The slug “wheel-harvester” is already in use by another term."

Link to a page where the issue can be seen:
hidden link

I expected to see:
That swedish description of this term has been updated

Instead, I got:
"The slug “wheel-harvester” is already in use by another term."

Term we are trying to update is the existing Swedish term 98.
PHP Code executed behind the page "test-debug-tc-wpml.php" is:

============== PHP CODE =====================
require_once( dirname(__FILE__) . '../../../../wp-load.php' );

$term_id = 98;
$taxonomy = 'product_types';
$current_lang = apply_filters( 'wpml_current_language', NULL );

$term_language_code = apply_filters( 'wpml_element_language_code', null, ['element_id' => $term_id, 'element_type' => $taxonomy] );
do_action( 'wpml_switch_language', $term_language_code );

$updated = wp_update_term( $term_id, $taxonomy, array('description'=> 'Högpresterande kortvirkesskördare som är byggda för tuff användning och krävande arbetscykler. Utmärkt sikt för föraren, nivellerande hytt och Tigercats kraftfulla WideRange®-drift hjälper till att maximera produktiviteten.') );

do_action( 'wpml_switch_language', $current_lang );

if ( ! is_wp_error( $updated ) ) {
var_dump($updated);
} else {
echo $updated->get_error_message();
}

============== PHP CODE =====================

March 3, 2022 at 7:00 am #10703601

Bruno Kos
WPML Supporter since 12/2018

Languages: English (English ) German (Deutsch ) French (Français )

Timezone: Europe/Zagreb (GMT+02:00)

Hi,

Thank you for contacting WPML support!

In your Debug Information I see you have WPML String Translation plugin which is not a part of our Blog package, may I ask how did you obtain it?

Regards,
Bruno Kos

March 7, 2022 at 2:07 pm #10730855

pauli-7

Hello Bruno,
License has been upgraded, please let me know what is the problem related to my previous questions for "wp_update_term" and how I can fix it.

Thank you.

March 8, 2022 at 9:13 am #10737367

pauli-7

Hello Bruno,

I did not get any answer from you regarding this issue, it's now important to find a solution ASAP for us.
Thank you.

March 8, 2022 at 11:38 am #10738821

Bruno Kos
WPML Supporter since 12/2018

Languages: English (English ) German (Deutsch ) French (Français )

Timezone: Europe/Zagreb (GMT+02:00)

Hi,

I asked our 2nd tier team about this, I'll get back to you as soon as I have any news or questions for you.

Regards,
Bruno Kos

March 8, 2022 at 12:52 pm #10739751

pauli-7

Ok thank you!
I'll wait for your answer then.
Regards

March 8, 2022 at 2:59 pm #10741521

Bruno Kos
WPML Supporter since 12/2018

Languages: English (English ) German (Deutsch ) French (Français )

Timezone: Europe/Zagreb (GMT+02:00)

Hi,

Would you be willing to provide me with WordPress credentials so I could investigate the issue directly?

https://wpml.org/purchase/support-policy/privacy-and-security-when-providing-debug-information-for-support/

I marked your next reply as private so that you can safely add credentials.

We would like to check something if this is about the case where you cannot update a custom term meta field, if the term has the same slug as a term in any other language.

Because that case is escalated to developers but has not been fixed and not sure when or how will it ben.

Regards,
Bruno Kos

March 9, 2022 at 10:44 am #10748161

Bruno Kos
WPML Supporter since 12/2018

Languages: English (English ) German (Deutsch ) French (Français )

Timezone: Europe/Zagreb (GMT+02:00)

Hi,

From what I see “hidden link has wheel-harvester, WordPress usually does not allow the same slug for terms.

WPML also appends language, but you can hack it via quick edit to have the same slug.

This is a known limitation, it might work in language in directory mode, you can try your script then (see image on which option I am referring to).

Or simply add your description here - hidden link - so without doing this through PHP snippet.

We discovered this case several years ago on this ticket https://wpml.org/fr/forums/topic/picture-on-a-category-traduction/, but due to low demand for such approach (so change this through PHP Code - this is only 2nd case in 4 years) this was not yet implemented nor I think it will be.

I will update this ticket if development tickets gets some movement, but apart from editing these manually there is no other workaround.

Regards,
Bruno Kos