50 Days to a Better Blog–Day 5: Tags vs Categories (and more)

WordPress

This post is the fifth of an ongoing series entitled “50 Days to a Better WordPress Blog”.  During this time, Mitch will be providing small snippits of code, plugins, and things you can do to make your blog more attractive, attain new readers, and keep old ones coming back time and time again. You can see the entire series here.

I get a lot of questions when I’m speaking on the proper use of tags and categories when it comes to blogging.  How many is too many?  Can I put my post into multiple categories? Should I put my post into multiple categories? What do tags really do?

What’s the Difference?

This question stumps 9 out of every 10 new WordPress users, and even some old users who just never had the courage to ask when they were starting out.  What exactly is the difference between a category and a tag?  Let’s put it into perspective.

Let’s say you’re a potential employee looking at job prospects.  You absolutely want to work at “company x” no matter what that job is.  There’s everything from the CEO all the way down to the Janitor.  You love the company, know everything about it, and would feel very much at home with like-minded people who feel the same way.

That company is a category – it’s a general topic that a post would feel at home with other like-written posts.  Posts about recipes, marketing, or even “just for fun” stuff can all go in the general category.

But what’s this? You are a specialized individual – you can work in any company, as long as it’s the right job.  You could work for “company x” as a copywriter, but you’d be just as happy working for “company y” as a copywriter.  You are a specifically trained person with a specific focus.

The job position is a tag – it’s specific, and spans multiple categories.  You could have tagged a post with “Microsoft” or “Apple” and it be in the “business” category, the “technology category” or any number of other categories that mention either company.

Bottom line rule of thumb: No more than 1 category, no more than 5-7 tags (absolutely no more than 9 max).

Custom Taxonomies

If you feel like you need to split your post off into other categories, consider how you want to sort the content.  If you’re using categories to sort items such as “house size” (for all of you real estate agents) or “operating system”, then you may want to consider using a custom taxonomy.  This lets you define other sorting parameters to help you organize your data.  The code below is an example of a custom taxonomy:

add_action( 'init', 'register_my_taxonomies', 0 );

function register_my_taxonomies() {

	register_taxonomy(
		'os',
		array( 'post' ),
		array(
			'public' => true,                      'hierarchical' => true,                      'labels' => array(
				'name' => __( 'Operating Systems' ),
				'singular_name' => __( 'Operating System' )
			),
		)
	);
}

See the red text?  That controls whether the taxonomy will behave more like a tag (false) or a category (true).  If it behaves like a category, you can have nested, sub-categories.  Taxonomies (as of WordPress 3.1) also generate archive pages just like your standard category pages, and with some extra code you can even rewrite that archive value as well.  Justin Tadlock has a fantastic post on custom taxonomies, if you’re interested.