get_variation_attributes() as $taxonomy => $terms_slug ){
// To get the taxonomy object
$taxonomy_obj = get_taxonomy( $taxonomy );
$taxonomy_name = $taxonomy_obj->name; // Name (we already got it)
$taxonomy_label = $taxonomy_obj->label; // Label
// Setting some data in an array
$variations_attributes_and_values[$taxonomy] = array('label' => $taxonomy_obj->label);
foreach($terms_slug as $term){
// Getting the term object from the slug
$term_obj = get_term_by('slug', $term, $taxonomy);
$term_id = $term_obj->term_id; // The ID <== <== <== <== <== <== HERE
$term_name = $term_obj->name; // The Name
$term_slug = $term_obj->slug; // The Slug
// $term_description = $term_obj->description; // The Description
// Setting the terms ID and values in the array
$variations_attributes_and_values[$taxonomy]['terms'][$term_id] = array(
'name' => $term_name,
'slug' => $term_slug
);
}
}
echo '
'; print_r($variations_attributes_and_values);echo '
';
*/
?>