To Custom Post Type, or not to Custom Post Type, that is the Question…

The WP Crowd

Andrew Killen

Published: April 18, 2016

Whether it is nobler in the mind to suffer the misfortunes of poor custom post type solutions over telling the customer that they are in fact wrong?

The problem is pretty simple and we web makers see it so often.  Imagine these requirements:

  • Must show youtube videos
  • Must have a blog
  • Must show soundcloud
  • Have an about page, contact page, terms and conditions
  • The latest blog item must show on the homepage at the top above the fold

Looks simple enough, and so as the developer we ask a few questions like:

  • Are you ever going to post videos or sound cloud in your blog post?
  • Do you need the videos, soundcloud and blog items to be separately listed?

To which a resounding response of “We will never cross post” and “they must be listed separately”

You might be thinking to yourself, I know I’ll make a content type for each of those and then then I can totally control them. I can make the video appear where the featured image is in the top on videos and easily pull out all of the soundcloud players so a listing can show them all without having to enter the post.

Well, it would be the worst mistake.

Why? Because users rarely want what you have just given them

They hear your apparently simple questions and make a knee jerk reaction with their answers, rather than the carefully considered answer you were expecting.

They way that they will actually try to use the system you make is to post everything as a blog and put the youtube videos and soundcloud items in there via links as the blog post is the one that shows above the fold where the others have their own listing area.

Yes, they will not understand their own requirements logic.

So what the solution?

The best way to do this is to offer 1 blog type (not many custom post types) that has the option to put in video or soundcloud audio as a post field in the admin screen, or via a shortcode (for more exotic players), or via direct link placement.

If the video is entered via the field it would replace the featured image as the playable content, or if done via shortcode/link.

If the soundcloud or youtube is entered via a form field rather than link, if could be separated by doing a meta_query using WP_Query so that a listing could be setup.

Other optional extras

Use post formats to define what the primary item is, or primary styling type.  If the user has the option to select post formats to define the look and feel of the page, they might find benefit, or you, the developer, might find it easier to split out your code in to more manageable sections.

You could also create a custom taxonomy called “capibilities” which the users can click on or off all the types of content they want to have in the post, with that you could hide and show what’s needed on screen in the admin page, and also split off the content in to listings on the front end.

What should you have done at requirements time?

You should have explained that people choose the path of least resistance, and will break systems to achieve their needs.  Once a work around is known it will become the norm. Thus it is better to give flexibility in 1 place not many.


Add all the functionality into 1 post type when reasonable, do not have many to do very similar jobs.

Get the latest from The WP Crowd

Leave a Reply


This site uses Akismet to reduce spam. Learn how your comment data is processed.