php – Replace attribute terms with wp_update_term (woocommerce)

Question

On the edit.php?post_type=product&page=product_attributes page I want to replace (when I import a product via my importer plugin) the term name of the Terms attribute with a new name.

enter image description here

For example: if the name ‘Old Name’ exists as (term) change it to ‘New Name’

I used the code:

$nname="New Name"; wp_update_term(69, '1display', array( '‎Old Name' => $nname, 'slug' => sanitize_title($nname) ) );

but it was unsuccessful, it didn’t work.

Can you tell me what I’m doing wrong?
Thank you

0
Linux 2 months 2023-09-26T06:09:29-05:00 0 Answers 0 views 0

Leave an answer

Browse
Browse