WordPress.org

Ready to get started?Download WordPress

Forums

What is a category slug? (8 posts)

  1. asleigh
    Member
    Posted 7 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
    Member
    Posted 7 years ago #

  3. openpundit
    Member
    Posted 7 years ago #

    category slug -> blogging
    category name -> Blogging

    Notice the first letter in each one?

    The slug would be used like this:
    -http://example.com/category/categoryslug/-

    Where as category name would look like this:

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

  4. brooksr
    Member
    Posted 7 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?

    Thanks,
    Brooks

  5. logista
    Member
    Posted 7 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.

    Clearer?

  6. emarvegt
    Member
    Posted 7 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
    Member
    Posted 6 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
    Member
    Posted 6 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

Tags