One of the biggest, and most useful additions to WordPress in recent years has been the introduction of Custom Post Types. Before CPTs, all the content in your site needed to either be in pages or in blog posts. If your site needed a lot of different types of data, you’d typically use categories (or even tags) to tell them apart. I’ve seen (and probably built) examples where “products” and “news” were post categories, and the site’s front-end would continuously filter out one of the two. In hindsight: madness.
Since the introduction of Custom Post Types, it makes sense to declare separate types for different types of data. When doing so, there’s a crucial argument (passed to the register_post_type function) called “supports”. This argument tells WordPress which post features should be available for the new post type. This allows you to mix and match various features. No need for an excerpt? Require a “featured image”? Need custom fields? No problem. But there’s a catch.
Built-in features only
There’s a fixed list of features you can enable or disable. They correspond to the features present in WordPress’s two built-in types, post and pages. Nothing else. And as far as I know, there’s no (easy, developer-friendly) way to add new features. As nice as CPTs are, I think this seriously limits their potential.
Imagine being able to do something like this to create a CPT for a travel video blog.
'supports' => array( 'title', 'editor', 'author', 'thumbnail', 'subtitle' 'video', 'geo-coords', 'event-time' )
The first four features come standard, but the real fun is in the other (fictitious) ones. Being able to add a video to a post in a manner similar to how featured images work could have many potential advantages over simply adding it into the post’s content. And although there are plugins that’ll let you geo-tag and add timestamps, not all of those support CPTs, and they do not all store data in the same way. They’re all adding data to posts, but they’re all doing it in their own way.
I’m not saying all these features should be in WordPress’s lean and mean core. Most of the ones I can come up with are arguably plugin territory. But it would be nice to be able to define custom post features once, and then be able to add them to any (custom) post type. WordPress could offer a coherent, standardized way for them to present themselves and store their data. A Widget API of sorts, for the backend.
One might argue that you can do all these things using meta boxes, post meta (or extra database tables) and such, but I feel there’s a certain elegance to opening up “post features” as an API. For one thing, there are plugins that let end users define CPTs without any coding, and this would give them more things to mix and match. And perhaps, something like the functionality of those plugins could eventually make it into core…?