public function deleteEmptyTaxonomies()
    {
        if (!empty(get_object_taxonomies('event'))) {
            foreach (get_object_taxonomies('event') as $taxonomy) {
                // Skip Event Groups and categories
                if ($taxonomy == 'event_groups' || $taxonomy == 'event_categories') {
                    continue;
                }

                $terms = get_terms(
                    array(
                        'taxonomy' => $taxonomy,
                        'hide_empty' => false,
                        'childless' => true,
                    )
                );

                foreach ($terms as $term) {
                    if ($term->count == 0) {
                        wp_delete_term($term->term_id, $taxonomy);
                    }
                }
            }
        }
    }
public function deleteEmptyTaxonomies()
    {
        if (!empty(get_object_taxonomies('event'))) {
            foreach (get_object_taxonomies('event') as $taxonomy) {
                // Skip Event Groups and categories
                if ($taxonomy == 'event_groups' || $taxonomy == 'event_categories') {
                    continue;
                }

                $terms = get_terms(
                    array(
                        'taxonomy' => $taxonomy,
                        'hide_empty' => false,
                        'childless' => true,
                    )
                );

                foreach ($terms as $term) {
                    if ($term->count == 0) {
                        wp_delete_term($term->term_id, $taxonomy);
                    }
                }
            }
        }
    }
public function deleteEmptyTaxonomies ( ) { if ( ! empty ( get_object_taxonomies ( 'event' ) ) ) { foreach ( get_object_taxonomies ( 'event' ) as $ taxonomy ) { // Skip Event Groups and categories if ( $ taxonomy == 'event_groups' || $ taxonomy == 'event_categories' ) { continue ; } $ terms = get_terms ( array ( 'taxonomy' => $ taxonomy , 'hide_empty' => false , 'childless' => true , ) ) ; foreach ( $ terms as $ term ) { if ( $ term -> count == 0 ) { wp_delete_term ( $ term -> term_id , $ taxonomy ) ; } } } } }
Delete empty event taxonomies
@return void
Delete empty event taxonomies