Tags, Categories and Taxonomies in WordPress

I had a customer recently who wanted to do some really interesting classification of content within WordPress. Because of this, I've taken a detailed look at tags, categories and taxonomies as implemented within WordPress 3.0.1 so that I could advise the client on best practices. I have some observations and comments that may prove generally useful.

Posts and Pages

WordPress basically provides the same tools to manage the content of posts and pages. In most WordPress themes, the primary differences between posts and pages is: 1) how they're intended to be perceived, 2) how they can have different templates governing how they appear, and 3) how pages can potentially exist in a hierarchy.

In general, most people think of posts as dynamic content like blog posts or news entries, whereas pages are considered to be more stable, long-term web site content that may exist in a hierarchy, e.g. - pages often have sub-pages. Depending on the intent of the site, the distinctions between posts and pages can be made more or less distinct.

Tags

Tags are basically free-form keywords that are used to describe a content item. Many WordPress themes show the tags associated with a posts, with the tags set up as links to dynamic pages that show all posts that have been assigned to the specified keyword. To avoid conflicts between page names and tag names, I recommend setting a base value of "tags" for all tag-specific pages, e.g. - /tags/oxygen would show all posts that have been tagged with the "oxygen" keyword. This can be done easily within the WordPress administration console.

The "tags" portion of the URL generally precludes conflicts with page names. For the record, it would not be good practice to then create a page called "Tags" as I would expect unusual behavior to ensue.

Categories

Categories are used to organize content into meaningful groups within a well-defined hierarchy. By default, WordPress provides one set of categories. WordPress refers to a set of categories as a taxonomy.

So, by default, WordPress supports one taxonomy. Out of the box, WordPress's default taxonomy is set up to only apply to posts. As with tags, there's generally an expectation that the name of the category will be a dynamic page that shows all content items that have been assigned to that category.

Accordingly, you can have namespace conflicts between page names and categories names. To prevent this, I recommend setting a base value of "topics" for WordPress's default categories, e.g. - /topics/vacation would display a dynamic page that lists all posts that have been assigned to the "Vacation" category.

Taxonomies

WordPress also supports multiple taxonomies, although this functionality within WordPress is not very mature. As a result, there are plugins that add capabilities to WordPress to better support taxonomies, particularly with regard to administering them.

Each taxonomy represents a set of categories, e.g. — "Disabilities" might be a taxonomy with a set of categories associated with it. As with tags and categories, there can be namespace conflicts between taxonomy names and page names. For example, the system will allow you to have a taxonomy called "Disabilities" and a page called "Disabilities", but the existence of the category would prevent access to sub-pages of that page.

In other words, if your page was called "Disabilities" and conflicted with a taxonomy called "Disabilities" then a sub-page of the "Disabilities" page called "Developmental Milestones" would be inaccessible because the system was expecting dynamic category pages under that URL and not actual content pages.

Unlike tags and categories, there doesn't appear to be a simple way to set a base path for taxonomies. On an individual basis, the conflict in my example can be avoided by changing the slug of the "Disabilities" page to something different, such as "disabilities-summary", so that the namespace conflict no longer occurs.

Conclusion

The bottom line right now seems to be that tags an and categories are long-term features of WordPress and are well-supported. Taxonomies are a much newer feature, and the support for them is considerably more rocky. So, using taxonomies within WordPress typically means that 1) you'll need one or more plugins to help manage the taxonomies, and 2) you may still need some custom development to integrate taxonomies into your site seamlessly.



Comments

David Keener By dkeener on Thursday, September 23, 2010 at 09:15 AM EST

This is a pretty good link with some more technical information about WordPress 3.0 taxonomies.

Introducing WordPress 3 Custom Taxonomies



Leave a Comment

Comments are moderated and will not appear on the site until reviewed.

(not displayed)