Inventory_Presser_Taxonomies::delete_term_data()

Removes all terms in all our taxonomies. Used when uninstalling the plugin.

On This Page


Return Return

(void)


Top ↑

Source Source

File: includes/class-taxonomies.php

	public function delete_term_data() {
		// remove the terms in taxonomies.
		$taxonomy_data = self::taxonomy_data();
		$count         = count( $taxonomy_data );
		for ( $i = 0; $i < $count; $i++ ) {
			$tax   = $taxonomy_data[ $i ]['args']['label'];
			$terms = get_terms(
				array(
					'taxonomy'   => $tax,
					'fields'     => 'ids',
					'hide_empty' => false,
				)
			);
			foreach ( $terms as $value ) {
				wp_delete_term( $value, $tax );
			}
		}
	}