Codex tools: Log in / create account
The get_category_by_slug() function is used to retrieve the ID of a category from its associated slug. This function accepts the category slug (in string format) and returns the corresponding numerical ID in the term_id property.
<?php
$idObj = get_category_by_slug('category-name');
$id = $idObj->term_id;
?>
Practical Use:
<?php echo category_description(get_category_by_slug('category-slug')->term_id); ?>