Justin Tadlock

A WordPress forum plugin using custom post types

Example screenshot of a WordPress forum plugin

I’ve been promising a real-world example of what’s possible with custom post types for a while. But, I didn’t want to put together yet-another-long-technically-detailed post. I wanted to give you something that would open your mind to the possibilities.

And, there’s loads of possibilities.

I’ve been tinkering around with the idea of building a forum plugin, so I decided to get behind the project completely and make it happen. What started out as a simple project quickly turned into something that a lot of people have been wanting — a forum plugin that fully integrates itself within WordPress.

Post types for the plugin

The plugin uses three post types for handling the structure:

  • Forums: This is your top level, which holds everything else.
  • Topics: Children of forums and use the topic tags taxonomy.
  • Replies: These are the individual posts made within a topic.

I had originally taken a different route of using a forum taxonomy, topic post type, and reply comment type. However, using that structure had major limitations.

The benefits of using three post types are numerous. Here are some examples:

  • Forums can have metadata (custom fields) and media attachments added to them to allow a lot of cool stuff (forum thumbnails, for example).
  • You get pretty permalinks using a reply post type (forums/topic-name/page/2).
  • Replies can also have their own media attachments (user-uploaded images).
  • Capabilities/permissions are handled a lot better with post types.
  • Can set up custom post statuses such as “closed” and use the current statuses like “private.”
  • Works well with plugins that allow you to edit from the front end of the site.

This is not to say there aren’t issues with this method. There’s a lot of custom work work that needed to be done, which isn’t surprising considering I’m using custom post types.

I can’t take all the credit for this idea of using three post types. John James Jacoby convinced me this was the best route to go.

Taxonomies for the plugin

The only taxonomy used by default is the topic tag taxonomy. It allows users to assign tags to specific topics.

The great thing about the plugin though is that you can build custom taxonomies on top of it. You can give forums, topics, and replies their own taxonomies if you wanted. Since we’re using custom post types for those things, the possibilities are endless.

Integration with WordPress

Obviously, we want our forum plugin to work well with WordPress. Some of the current problems users of other forum software are facing when integrating are:

  • Separate user login pages (and separate user database tables in some cases).
  • Separate roles and permissions setups.
  • Using multiple themes to get the same design across the site.
  • Not being able to use WordPress plugins within the forum.
  • Having to figure out how “deep integration” works just to use things like menus and widgets.

My plugin seeks to solve those issues and use the tools available in WordPress.

Lightweight

I’m not a fan of adding every fancy gizmo and gadget in the world to a forum. I like to keep things simple and extend it with other plugins when I need a new feature. I also don’t want 20 theme templates when I can use a handful.

The biggest goal I have is to keep this thing as lightweight as possible. There are over 10,000 plugins for WordPress that will allow this plugin to be extended.

What about the bbPress plugin?

While this is outside the scope of what I’d planned on writing about, I know questions about bbPress will crop up. I’ll try to address those.

It’s true that bbPress will be becoming a plugin in the future and work has already started on it. I’m happy that there’s at least something happening. I love bbPress and have been using it for years, but I can’t wait around six or seven months again to see where the project is headed. I’m not saying bbPress isn’t going anywhere, but I had to make the decision to move forward on my own after the last disappointment.

I’d love to be involved in the bbPress plugin project at some point, but my priorities right now don’t mesh well with it. It’d also be great if the ideas used in my plugin or any of its code gets used in the bbPress plugin.

One thing I will promise to plugin users is that I’ll try to make it as easy as possible to switch between either plugin if that’s what they choose to do.

Demo and testing

The plugin isn’t ready for a public release right now. There’s tons of work still ahead. But, testing does need to be done on a large enough scale for me to make this a solid plugin.

I’ve put the plugin on one of my own sites for live testing. If you have any interest in this plugin at all or just want to help test, please register for my forums at Pop Critics.