I'm working on a from-scratch rebuild of a site for a TV network that has a fairly large amount of content (~50 Shows, ~3000 Episodes, ~300 Movies, ongoing schedule entries, etc.).

We want to be able to list a schedule of upcoming programming in a way that is very much like ABC: http://abc.go.com/schedule

Their existing scheme for structuring and connecting custom post types and taxonomies is the result of several different developers over several years, and it's become quite convoluted, so we're starting over with the new site and we want to do things cleanly.

We're using the Toolset plugin (specifically Types and Views) to set up the content model for the site: https://wp-types.com

Here's what we have in place so far that I feel reasonably confident about:

  • The major content types are Movies, Shows and Episodes. These are currently set up as custom post types.

  • The Shows and Movies have taxonomies for things like genre, whether the content is original or acquired, and so on.

  • Shows and Episodes have a one-to-many relationship, with many Episodes belonging to a single Show. Movies are standalone content entries.

  • Each Show, Episode and Movie has a Title, Description, and variety of metadata that is imported from a CSV file (stuff like episode number, a title code, first air date, etc.).

The big question is how to handle the Schedule portion of the site.

Under the old system, Schedule entries were given their own post type which repeated many of the same fields found on Episodes and Movies.

Every day, two weeks worth of schedule entries (in half-hour increments) would be imported via a CSV file on a chron job, deleting all of the old schedule entries and adding new ones in the process. So we're taking hundreds and hundreds of entries.

These schedule entries would have names like "02-27-2017 - 7:00-8:00" and their content and metadata would essentially be duplications of content that was already in the Episode or Movie entry.

This seems to me like a very-not-ideal way to handle this, but I'm not totally clear on the best way to do it, either.

Would a schedule like the one on ABC require those schedule items to be their own individual custom post type entries, or is there a cleaner way to handle this?

If they do have to be custom post type entries, how do we keep them as clean and minimal as possible, only referring to content that already exists in the appropriate episode or movie entries and not duplicating it?

Any insight is much appreciated!

1 Answer 1


Normally, the start and end time could be a post meta for your custom post types. But the meta tables aren't made for search queries, that would slow down your site.

I would use custom tables for this: one for time slots, one for the post relationships.

table slots
id | start (DATETIME) | end (DATETIME) 

table slot_relations
id | slot_id (INT) | post_id (INT)

You don't need a description for the time, but you might need overlapping time slots, and you will need very fast queries. Setting the slot columns as DATETIME (in contrast to the meta table's VARCHAR) will help you running custom queries and comparisons.

You will probably have to filter pre_get_posts almost everywhere to add your custom ordering, but that's something you can easily abstract away.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.