How to Change Your Default Category From “Uncategorized” in WordPress

For this tutorial, we will show you how to change the WordPress default category from “Uncategorized” to another category of your choice.

But why would I want to change this?

Categories are a type of WordPress taxonomy that helps users organise their posts or utilise them for filtering. By default, WordPress sets the default category automatically; this is defined as “Uncategorized”. With this, it becomes mandatory to manually select the desired category before publishing any new post. It’s a minor step, but it can quite frequently disorganise your website if you forget to update the post category on occasions.

The good news is, we can change the default category to any other category you want. For example, if you add a Category called “News”, we can make this the default and even remove the “Uncategorized” category.

Here are the 6 steps to change your default WordPress Category

1. Login to your WordPress Dashboard.

2. Navigate to Posts > Categories from the left side menu bar.

3. Add a new category that you would like to make your default category.

4. Select Writing > Settings from the left hand side bar menu.

5. Change the Default Post Category from “Uncategorized” to your newly preferred default category using the drop down menu.

6. Click Save Changes and that’s all there is to it! Your new posts will automatically select your new chose default category.

Conclusion

Changing the default category isn’t difficult when you follow the above steps, if you’ve not done it before you may not know where to look.

You might wonder why it matters… Well, having categories defined as “Uncategorized” doesn’t really give the user any idea of the blog posts they will reading. So having properly defined categories is always better not only for your website users, but using this along with tags will always help your websites crawl abilities by search engines. Categories and Tags are great elements to improve rankings and search visibility with websites today.

We hope you enjoyed this article, happy coding everyone!

 

Nathan da Silva - Profile

Posted by: Nathan da Silva

Nathan is the Founder of Silva Web Designs. He is passionate about web development, website design and basically anything digital related. His main expertise is with WordPress, Magento, Shopify as well as many other frameworks. Whether you need responsive design, SEO, speed optimisation or anything else in the world of digital then get in touch. If you would like to work with Nathan, simply drop him an email at [email protected]

It’s good to share

WordPress – How to add Category Name to the body class

The body_class function is great for adding a bunch of classes to the body tag that has information about what kind of page you are currently viewing, most likely for styling purposes. As a default, it doesn’t include a class for the current category (or categories) for a single post.

The below PHP code adds the category ‘nice’ name, and you can simply add this to your functions.php file:


add_filter('body_class','add_category_to_single');
  function add_category_to_single($classes) {
    if (is_single() ) {
      global $post;
      foreach((get_the_category($post->ID)) as $category) {
        // add category slug to the $classes array
        $classes[] = $category->category_nicename;
      }
    }
    // return the $classes array
    return $classes;
  }

We needed to do some specific styling for each of the different categories for single posts and this was a good way to achieve that. Let’s say you had the category ‘Technologies’ and you wanted to make the h1 tags blue. The PHP code above will add the class ‘technologies’ to the body so that you could style all the posts with this category as simple as doing:-


body.technologies {
    color: #2581c4;
}.

Pretty simple right?

Hope this helps! Happy coding 😉

 

Nathan da Silva - Profile

Posted by: Nathan da Silva

Nathan is the Founder of Silva Web Designs. He is passionate about web development, website design and basically anything digital related. His main expertise is with WordPress, Magento, Shopify as well as many other frameworks. Whether you need responsive design, SEO, speed optimisation or anything else in the world of digital then get in touch. If you would like to work with Nathan, simply drop him an email at [email protected]

It’s good to share