I am trying to remove a string off of a bunch of slugs in terms from a CPT taxonomy. For example, I have a term named "Accounting" but the slug has the "accounting-expert-witnesses" I just need to remove the "-expert-witnesses" part of the slug. I am using this post as a reference as it appears to be what am I looking for but I cannot seem to get any of the suggestions to work: https://wordpress.stackexchange.com/questions/58938/how-to-update-taxonomy-custom-field-with-wp-update-term I have tried using update_term_meta, update_post_meta, wp_update_term and none of them are doing what I need. The closest I've got is using update_term_meta and it appears to be working when I error log the result however when I look at the terms in the dashboard nothing has been updated. I can't figure out what I'm doing wrong here? function remove_stuff() { $terms = get_terms( array( 'taxonomy' => 'experts_industries', 'hide_empty' => false, ) ); foreach($terms as $term) { $newSlug = str_replace('-expert-witnesses', '' , $term->slug); //update_term_meta($term->id, 'slug', $newSlug); //update_post_meta($term->id, 'slug', $newSlug); wp_update_term($term->id, 'experts_industries', array( 'slug' => $newSlug )); error_log($term->slug); } } add_action( 'wp_loaded', 'remove_stuff' );