delete_terms()

Summary

No summary available.

Source

File: uninstall.php

function delete_terms() {
	foreach ( get_taxonomy_list() as $tax ) {
		// In order to get the terms, taxonomy must first be registered
		register_taxonomy( $tax, Product::NAME );

		$terms = \get_terms( [
			'taxonomy'   => $tax,
			'hide_empty' => false,
			'fields'     => 'ids',
		] );
		foreach ( $terms as $term_id ) {
			\wp_delete_term( $term_id, $tax );
		}
		\clean_taxonomy_cache( $tax );
	}
}


User Contributed Notes

You must log in before being able to contribute a note or feedback.