The Support Forums will be in read-only mode for a scheduled maintenance window on 01 September 2016 14:00 UTC - 20:00 UTC. More information.

What is a category slug? (8 posts)

  1. asleigh
    Posted 9 years ago #

    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.

  2. 4k
    Posted 9 years ago #

  3. openpundit
    Posted 9 years ago #

    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.

  4. brooksr
    Posted 9 years ago #

    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?


  5. logista
    Posted 9 years ago #

    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.


  6. emarvegt
    Posted 9 years ago #

    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.

  7. thepete
    Posted 9 years ago #

    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.

  8. MichaelH
    Posted 8 years ago #

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

Topic Closed

This topic has been closed to new replies.

About this Topic