Add categories and tags support to custom post types in WordPress

Adding a custom post type in WordPress is pretty easy and while it can be done and managed via external plugins, it’s pretty easy to do it by adding a little code in the functions.php file of your theme. All we need to do is take advantage of the “register_post_type” method that’s provided by wp. You can see more details and all the params on the Codex.

Here is a simple example that creates a custom post type named “project”:

By default, this new custom post type doesn’t has the ability to use taxonomies (categories, tags, or any other custom taxonomies you might need), but that can be easily added. Simply add ‘taxonomies’ => array(‘category’, ‘post_tag’) to the $args variable then initialize the new taxonomies. The code will look like so:

If anyone knows an easier way (without using a plugin) of achieving this, please use the comments section below!

Made the switch to wordpress

I’ve been using MovableType as the platform for my blog and i’ve been really happy with it. The reason i decided to switch to WordPress is simply because it’s written using PHP and i’m able to easily extend it, unlike MT which is built in perl.
I haven’t got a change to import the comments so far, but hopefully i’ll get to that this week.

Let me know if you find a broken link or something unusual.