taxonomy – update_term_meta not working


I am trying to remove a string off of a bunch of CPT taxonomy slugs that were added and need to get removed.

I’m trying to use update_term_meta and it appears to be working when I error log the result however it does not appear to have worked when I view the terms through the dashboard?

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) {

        update_term_meta($term->id, 'experts_industries', array('slug' => str_replace('-expert-witnesses', '' , $term->slug) ));



add_action( 'wp_loaded', 'remove_stuff' );

BTW: I’m not worried about the wp_loaded action, I’m doing everything locally and then removing this code. Unless that’s the problem…?

grzybowski1911 5 months 2022-06-30T15:38:11-05:00 0 Answers 0 views 0

Leave an answer