I'd like to store information about TV shows this way:

series (general information about the series)

--episode 1 (video of ep.1 + info about episode)

--episode 2 (video of ep.2 + info about episode)


--episode n

Taxonomies could be used for some of the additional info, such as production year, actors, network, etc.

I've currently set this up with a Page for each show and regular Posts for each episode. I link the episodes together with the Organize Series plugin.

Is this possible using just custom post types? It seems like it would make things easier as the site grows.

Thanks for any help.

2 Answers 2


I'm using this code for a metabox in a current project I'm working on:

function parent_select ($parent_type) {
    global $post;
    global $wpdb;
    $query = "SELECT ID, post_title FROM $wpdb->posts WHERE post_type = '{$parent_type}' AND post_status = 'publish' ORDER BY post_title";
    $results = $wpdb->get_results($query, OBJECT);
    echo '<select name="parent_id" id="parent_id">';
    echo '<option value = "">None</option>';
    foreach ($results as $r) {
        echo '<option value="', $r->ID, '"', $r->ID == $post->post_parent ? ' selected="selected"' : '', '>', $r->post_title, '</option>';
    echo '</select>';

This code outputs a select box that is populated by the post titles and post id's of all posts of a certain type. If you place this in a metabox of a child post type, all you would need to do is to is select a parent post and update. WordpPress already looks for a form element called 'parent_id' to set a post's parent, so there is no other code really needed, except to create the metabox:

add_meta_box('parent_series', 'Series', 'show_series_metabox', 'episode', 'side', 'high');  //add a side metabox
function show_series_metabox() {
    echo 'Please select series';

Ironically enough, I'm doing this for a similar situation: I have a post type for a series, 2 other post types, one for episodes and one for DVD releases, both of which hook up to a series as a parent-child relationship using the post_parent field of a post.

Special thanks to @MikeSchinkel, whose code I modified

  • The code from Manny Fleurmond is working fine but it causes the permalinks to go nots. Anyone found a solution for this? Sep 30, 2011 at 10:47

Yes, it's possible, by using the post_parent field in the wp_posts table.

You will have to write a custom metabox for setting the relationship though.

  • Wouldn't that just be the same as using a hierarchal post type? Or are you suggesting creating a custom box to relate the post parent to that of a differing post type?
    – t31os
    Feb 24, 2011 at 18:01
  • @t31os In my case, it'd probably be different post types, as an Episode would hold different info than its parent Series. Not sure whether @scribu 's answer addresses that issue.
    – cgranier
    Feb 24, 2011 at 18:07
  • I've never done anything like this myself, i was simply curious for clarification on what is being proposed. :)
    – t31os
    Feb 24, 2011 at 18:10
  • @scribu,t31os: why not use a custom taxonomy to create the relationship?
    – Bainternet
    Feb 24, 2011 at 18:37
  • @בניית אתרים (how is that pronounced?) I've been down that road. It's not pretty. Feel free to add an answer with more details, though.
    – scribu
    Feb 24, 2011 at 19:44

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.