Inventory_Presser_Taxonomies::unregister_taxonomies()

Users can turn off taxonomies provided by this plugin. This method unregisters taxonomies that are turned off.

On This Page


Return Return

(void)


Top ↑

Source Source

File: includes/class-taxonomies.php

	public function unregister_taxonomies() {
		$settings = INVP::settings();
		if ( ! isset( $settings['taxonomies'] ) || empty( $settings['taxonomies'] ) ) {
			return;
		}
		$taxonomy_data = self::taxonomy_data();
		foreach ( $taxonomy_data as $taxonomy_array ) {
			if ( ! isset( $settings['taxonomies'][ $taxonomy_array['args']['query_var'] ]['active'] )
				|| ! $settings['taxonomies'][ $taxonomy_array['args']['query_var'] ]['active'] ) {

				/**
				 * Category taxonomy is not enabled on vehicles. Some users want
				 * it, though. Do not unregister the category taxonomy here--it
				 * must have been added explicitly via filter.
				 */
				if ( 'category' === $taxonomy_array['args']['query_var'] ) {
					continue;
				}

				unregister_taxonomy_for_object_type( $taxonomy_array['args']['query_var'], INVP::POST_TYPE );
			}
		}
	}