WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I cannot figure out how to get the taxonomy term name if I have the taxonomy term's ID.

This is my current code

// create a dropdown menu of the quantity taxonomy 
    array('taxonomy' => 'quantity_category', 'name' => 'productQuantity', 'hide_empty' => 0)

$quantityTerms = $_POST['productQuantity'];
$quantityTax   = 'quantity_category';

The value of $quantityTerms is not the "name" of the quantity but the ID of the quantity category. When it sets the object terms, it creates a new category called "ID#" and not inserting it into the category by name.

wp_set_object_terms( $post_id, $quantityTerms, $quantityTax, $append );
share|improve this question
@JonFury, many of your questions demonstrate a complete lack of research effort - you could have answered this question for yourself by typing it's title into Google, not to mention that's it's answered in numerous other on-site questions that you would have seen had you searched WPSE. No one wants to waste their time answering questions that have been answered a hundred times before already. Please use a search engine, the WPSE search, and the WordPress codex before slapping questions on WPSE. Our community is not a search engine. – bosco Jan 1 '14 at 22:17

The function get_term_by() would allow you to get the taxonomy term name from the id.

$quantityTermObject = get_term_by( 'id', absint( $quantityTerms ), 'quantity_category' );
$quantityTermName = $quantityTermObject->name;
share|improve this answer
Thanks!@##!!!!! – Jon Furry Nov 27 '13 at 4:42
Please accept the answer if it worked for you @JonFurry. – Rachel Baker Nov 27 '13 at 13:25

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.