PHP – WordPress – Get Category Slug

This following PHP example helps you to get the current category slug in WordPress.

Code Example:

<?php
if(is_category()) {
	$cat = get_query_var('cat');
    $yourcat = get_category($cat);
    echo "the slug is" . $yourcat->slug;
}
?>

Post to Twitter Post to Digg Post to Facebook Post to Google Buzz Send Gmail