Not sure if this is possible, but bear with me. I think I am halfway there.

First a little background: I'm using the build in hierarchy in WordPress to form relationships between post types. I have a post type called series that holds info on a TV series. I have another post type called content that has info on specific episodes and I use the built in post_parent field on the posts data table to point to a series.

So basically, I'm trying to do a rewrite/permalink structure similar to this for content:


content-type is a taxonomy attached to content that has a few terms; episode, movie and special.

My idea to prevent rewrite collisions was to use this code, inspired by a previous question I had asked here

add_filter( 'rewrite_rules_array', 'content_rewrite_rules',10,1);
function content_rewrite_rules( $rules ) {
        $custom_rules = array();
        $type_terms = get_terms('veda_content_type', array('hide_empty'=>false));
        if(!is_wp_error($type_terms) && sizeof($type_terms) > 0) {
            foreach ($type_terms as $term) {
                $custom_rules['([^/]+)/'.$term->slug. '/([^/]+)/?$'] = 'index.php?post_type=veda_content&series_name=$matches[1]&pagename=$matches[2]';

        return array_merge($custom_rules , $rules);

Using the rewrite analyzer, it seems that it sorta works, except it shows that the series_name query_var is crossed out in red and I'm not sure what that means. Rewrite 1 My question is: is there another, more efficient way to create the permalink that I want? Also, what the cross out mean?

EDIT: I'm trying to see if the rewrite works and my server is giving me bad request errors

  • Also check out: core.trac.wordpress.org/ticket/14513
    – edelwater
    Jun 18, 2011 at 16:48
  • @edelwater I already have a good setup for doing the relationships between the post types, I just need help optimizing my rewrites. Jun 19, 2011 at 4:11
  • You should go to the WPSE Plugin repository and just comment on the plugin.
    – kaiser
    Aug 29, 2011 at 0:24

1 Answer 1


I did find some solutions to the problems I had above:

Red strike through in the Rewrite Analyzer plug in means that the query_var wasn't defined before hand, so WP automagically deletes them. The other problem I had was solved here: Using %postname% tag with a Custom Permastruct creates 400 Bad Request Errors from the server

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.