How to Make Your Own Custom Post Formats in WordPress

September 2, 2016 10:36am

Post Formats were introduced into WordPress awhile back to mimic those available in Tumblr, and theoretically across other blogging platforms. The first thing any good developer wanted to know was, “How do I make my own?”

Well, you can’t. This is by design, because they’re supposed to be “industry standard” formats that allow them to be ported from one platform to another. Swell.

You can’t add new Post Formats to WordPress’ built in feature, however you can just create your very own setup instead via custom taxonomies and some other trickery.

What if you want to create your own system of post formats though, such as I needed for a recent project? NBD, we can do it fairly easily as Post Formats are just another type of custom taxonomy. All we need to do is:

Create a custom taxonomy and assign it to posts.

Programmatically create the terms in that custom taxonomy, in a way where non-admins can’t create. edit or delete new ones, but can assign them to posts.

Set a default post term.

Change the way the custom taxonomy is displayed on the post editor page, so that only one format can be chosen.

Depending on your needs, of course, steps 2, 3 and 4 may be optional, but if you’re not restricting your authors to a specific set of formats, you might as well just create the custom taxonomy and be done with it. This setup is useful if you want to have custom post formats so that you can style certain posts differently or something.

Here’s the complete code, just add it to your functions.php and voila!

Muchas gracias to the many resources I found that helped put this all together, i.e. TheDeadMedic on WordPress StackExchange for how to get the radio buttons instead of checkboxes, mayeenulislam on GitHub for the code to set a default term in our taxonomy, and Tom McFarlin for how to programmatically set terms in a custom taxonomy. Oh, and of course, my family, Zeus, and everyone at the Screen Writer’s Guild for never giving up on me when I was just a burgeoning actor living in the mean streets of South Nanty Glo…or something.

If you have the ability to work with functions.php, you could use remove_theme_support('post-formats') if they’ve already been added to your theme, and then add them back in like this, only including the ones you want: