delete_term is not working properly with add_action()
AFAIK, slug is unique. So $post_cat_term = get_term_by( ‘slug’, $deleted_term->slug, ‘category’ ); shouldn’t return anything. Instead, you may try name. Also, delete_term callback gets 5 parameters, so it’s better to adjust that accordingly. See if the following works: function delete_similar_term( $term_id, $tt_id, $taxonomy, $deleted_term, $object_ids ) { if( $deleted_term->taxonomy === ‘movies_category’ ) { $post_cat_term = … Read more