Is there a WP function to get taxonomy name from taxonomy_term_id?

I need to get the taxonomy name from the taxonomy_term_id.

I am currently using the following to get it:

Read More
global $wpdb;
$term_taxonomy_table = $wpdb->prefix . "term_taxonomy";
$taxonomy = $wpdb->get_var($wpdb->prepare("SELECT taxonomy FROM $term_taxonomy_table WHERE term_taxonomy_id = $tt_id"));

I was wondering if there is wordpress function that replaces that SQL query? I like to avoid using SQL queries.

If there isnt, please tell me if the SQL query I am using is correct and safe. Thank you.

Related posts

Leave a Reply