Support » Requests and Feedback » What is a category slug?

What is a category slug?

  • This is a really basic question – but what is meant by the term ‘category slug’ when making new categories? I’ve never heard of this term and can’t find a definition.

    Your help is appreciated.

Viewing 7 replies - 1 through 7 (of 7 total)
  • category slug -> blogging
    category name -> Blogging

    Notice the first letter in each one?

    The slug would be used like this:

    Where as category name would look like this:

    This post is filed under ‘Blogging’ <- thats the category name.

    This is still not clear.

    The slug is in lowercase. Is that important?

    Where, exactly, in WP would the slug be used vs. the category name?


    A slug is used to help create a valid URL to the [category, post, date, etc] listing. So while a category might be named I Like Mom's Cooking the corresponding slug would be i-like-moms-cooking

    If you don’t make one for yourself, WP will make one for you.


    Still quite strange, because the character limit in the database for a name is 55 characters, and for a slug it is 200 characters.

    I would expect that the name is longer, since it’s the one that you see in the blog.

    See, now, I was thinking how cool it would be if I could use a tag like < ?php get_cat_slug(); ? > or something similar to use the category slug to determine how a particular post looked. I could enclose the standard post tags with div tags in my index template and define the properties of the div with CSS by adding them under each category slug. But there doesn’t seem to be a “get_cat_slug” type of tag. At least, none that I can find and I’ve been looking for about an hour. Pulling my hair out, even.

    Look at the category_nicename member returned with the template tag, get_the_category().

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘What is a category slug?’ is closed to new replies.