Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I have a link category with the id $id=23; and the slug $slug=friends;. I managed to read all links from that category using get_bookmarks($id).

Now I also want to use the name and the description ob the link category. How geht I get these values? I tried for example:

$cat = get_the_category($id);
$output .= "<p>Description: ".$cat[0]->category_description."</p>";

unfortunately this (and other things) did not work.

So how can I receive the name and the description ob the link category with the id=23? Is it also possible to recieve this via the slug of the link category? I tried get_category_by_slug($slug), but this always gave an empty result,...

share|improve this question
add comment

1 Answer 1

up vote 3 down vote accepted

http://codex.wordpress.org/Function_Reference/get_term_by

example:

<?php 
$link_id = 23;
$link_category = get_term_by('id',$link_id,'link_category'); 
var_dump($link_category);
?>
share|improve this answer
add comment

Your Answer

 
discard

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.