How get the current category id and slug using hooks: WordPress


Hello Everyone!

If you want to get the category id and category slug of current category page , then use my code 🙂

$cur_cat = get_cat_ID( single_cat_title("",false) ); //get the cat id
$category = &get_category($cur_cat);
$category->slug; //get cat slug

Enjoy Code!

Advertisements

Sr. Software Engineer

Tagged with: , ,
Posted in Wordpress

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: