For category view you can use this code snippet. slug; } ?> ============== For single view or post view ID , 'category'); if($terms) { foreach( $terms as $term ) { $cat_obj = get_term($term->term_id, 'category'); $cat_slug = $cat_obj->slug; } } echo 'The slug is '. $cat_slug; ?> SIMPEL: ID , 'category'); if($terms) { foreach( $terms as $term ) { $cat_obj = get_term($term->term_id, 'category'); $cat_slug = $cat_obj->slug; } } echo $cat_slug; ?> ============== Still hungry? If in the case you only want to get category slug using category ID don’t worry folks, I’ve provided a solution on it too. Step 1: In your function.php file, put this function. function get_cat_slug($cat_id) { $cat_id = (int)$cat_id; $category = &get_category($cat_id); return $category->slug; } Step 2: Once done, you can use the function like the below code. atau