Taxonomy with_front causes all

I have a custom taxonomy, which sets the with_front to false to try and get the URLs to look like /%type%/%brand%/%product%/, degrading as we go down. This however is driving me nuts. Everything in the code works, this works, but it causes every other page on the site to 404. I’d imagine the reason is something like with_front makes it think all requests are for elements of this taxonomy. But I can’t work out how to fix it.

Just FYI, make labels is my lazy function that produces the labels we require for this.

Read More
register_taxonomy ('types','brands',
   array(
       'hierarchical' => false,
       'labels' => make_labels('Type'),
       'show_ui' => true,
       'query_var' => true,
       'rewrite' => array( 'with_front' => false, 'slug' => false)
   )
);

$types = get_terms('types');

foreach($types as $type) {
    add_rewrite_rule("^$type->slug/([^/]*)/([^/]*)/?","index.php?hd_types=$type->slug&brands=$matches[1]&products=$matches[2]",'bottom');
    add_rewrite_rule("^$type->slug/([^/]*)/?","index.php?brands=$matches[1]&types=$type->slug",'bottom');
}

Then we create the custom post types brands and products.

Driving me nuts! Thanks in advance.

Related posts

Leave a Reply

1 comment