It's all about the answers!

Ask a question

How to get Category Name by passing Category uuid (using Java Client Plain API)

Rajat Krishnan (235) | asked Jan 09, 12:40 p.m.
edited Jan 09, 1:07 p.m.
Hello Community,
 I am trying to fetch category name using category uuid as a input parameter , is it possible ?

As Solution ,I am already using hashmap to store categorylist as key and category uuidList as value and matching user input uuid with hashmap value and i am able to get category name , but was just curious to know is there any way by i can fetch category name using category uuid as a input parameter?

Thank you

Accepted answer

permanent link
Ralph Schoon (57.3k23642) | answered Jan 11, 2:42 a.m.
You can create an item handle based on the UUID and once you have the handle you can resolve the item.

ICategory.ITEM_TYPE.createItemHandle(UUID.valueOf(uuid_string), null);
Rajat Krishnan selected this answer as the correct answer

Rajat Krishnan commented Jan 11, 2:49 a.m.
Hi Ralph ,
This worked for me
Thank you very much

One other answer

permanent link
Steven Roger (11) | answered Jan 20, 10:08 a.m.

 The only alternative I know of (using core functions) is:

// Get terms whose name begins with "my_name"
get_terms( 'category', array( 'name__like' => 'my_name' ) );

// Get terms whose name contains "my_name" get_terms( 'category', array( 'search' => 'my_name' ) );

If you need an exact match, you'll have to execute a custom query.

$wpdb->get_results( "SELECT t., tt. FROM $wpdb->terms AS t
    INNER JOIN $wpdb->term_taxonomy AS tt ON t.term_id = tt.term_id
    WHERE tt.taxonomy = 'category' AND = 'my_name'"

<time datetime="2012-07-21T23:15:15" itemprop="dateCreated" style="border: 0px; box-sizing: inherit; font-family: inherit; font-stretch: inherit; font-style: inherit; font-variant: inherit; font-weight: inherit; line-height: inherit; margin: 0px; padding: 0px; vertical-align: baseline;"> </time>

Your answer

Register or to post your answer.