I need to get the taxonomy name from the taxonomy_term_id.
I am currently using the following to get it:
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.