'How to get active Taxonomy Name in WordPress

I am customizing the Taxonomy edit page in the back-end.

My requirement is to get ALL the ACTIVE taxonomy slug.

For that, I am using the following code.

global $wpdb;

$table_name_tax = $wpdb->prefix . 'term_taxonomy';

$column_name = 'taxonomy';

$get_taxonomy_slug = $wpdb->get_col( "SELECT DISTINCT {$column_name} FROM {$table_name_tax}" );

echo "<pre>"; print_r( $get_taxonomy_slug ); die;

Now the problem is previously I have installed the WooCommerce plugin in my project. But, Now I have de-activated/Removed that plugin but still, I am getting the WooCommerce product's Category/Taxonomy in array as shown below.

Array (
[0] => category
[1] => pa_color
[2] => post_tag
[3] => product_cat
[4] => product_type
[5] => product_visibility
[6] => wp_theme
)

How do I get Active Taxonomy name here ?



Solution 1:[1]

I manage to show the active Taxonomies using following code.

$args = array(
  'public'   => true,
  'show_ui' => true
); 
$output = 'names'; 
$operator = 'and'; 
$taxonomies = get_taxonomies( $args, $output, $operator ); 

echo "<pre>"; print_r( $taxonomies ); die;

Here 'show_ui' => true will display only active taxonomies.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Parthavi Patel