Wordpress Get Category Slug


/ Published in: PHP
Save to your folder(s)



Copy this code and paste it in your HTML
  1. if(is_category()) {
  2. $cat = get_query_var('cat');
  3. $yourcat = get_category($cat);
  4. echo "the slug is" . $yourcat->slug;
  5. }

URL: http://www.bestwpthemez.com/wordpress/code-to-get-current-category-slug-in-wordpress-blog-1434/

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.