This rewrite rule should work (assuming “brand” and “type” are the taxonomy registered names):
function custom_rewrite_rules() {
add_rewrite_rule('^brand/(.*)/type/(.*)?', 'index.php?brand=$matches[1]&type=$matches[2]', 'top');
}
add_action('init', 'custom_rewrite_rules');
Remember to flush the rewirte rules after saving this code in your site.
Then you will need to hook in several places to fix things. For example, you may need to hook wp_title
to generate the correct title for the document, for example “HP Printers” instead or just “HP”, as this won’t be handle automatically by WordPress. I can’t give a exhaustive list of things you will need to fix.
Related Posts:
- Custom Post type & Taxonomy URL structure
- Dynamic taxonomy in permalink made all other posts NOT FOUND?
- Remove taxonomy slug when not assigning taxonomy with custom post types
- Remove Taxonomy Slug when No Taxonomy is Assigned to Custom Post Type?
- Custom Permalink with Dynamic Taxonomy for Custom Post Type – Works, but breaks other permalinks
- Custom Taxonomy breaking pages permalinks
- Custom Post Type with two hierarchical Custom Taxonomies: strategy to generate best permalink structure
- Custom Post Type Advanced Slug
- Custom post type URL structure with site.com/custom_taxonomy_slug/post_name
- Remove Custom Taxonomy Slug only without removing Custom post type slug in permalinks
- Custom Post Type Permalinks Problem
- Hide custom post type slug url from search engine [closed]
- Custom post types, taxonomies, and permalinks
- Permalinks: custom post type -> custom taxonomy -> post
- Mixing custom post type and taxonomy rewrite structures?
- How do I append multiple taxonomies to the URL?
- WordPress Rewrite Rules for Custom Post Type and Taxonomy
- Why does a custom post type need the ”hierarchical’ args setting?
- How to modify URL structures in custom post types and taxonomies or terms
- Taxonomy archive with same slug as custom post type?
- Having a custom post slug that clashes with an existing directory
- Help with a TV series Rewrite structure
- array_pop() expects array, boolean given for $event_type_term ->slug
- custom post type permalinks with category and tags
- Permalink rewrite with custom post type and custom taxonomy
- Custom Post Type with Nested Taxonomy and Template Files
- Semantic URL Custom Post Type and Taxonomies permalinks
- Remove Slug from Custom Post Type results in 404
- Page to display an archive of taxonomies
- How to create a permalink for custom taxonomies and custom post types like base-name/parent-tax/child-tax/custom-post-type-name
- How to show custom taxonomy in the permalink?
- Date-based permalinks for Custom Post Type, and custom taxonomy permalinks
- Permalinks for custom post-types within custom taxonomies not found
- Passing parameters to WordPress static front page
- Add hierarchical taxonomy to permalink for custom post type
- Custom post types, taxonomies, and permalinks
- Parent & Child Taxonomy slugs in custom post permalink
- Custom Post Types and independent Categories – complex Taxonomy
- custom permalinks based on taxonomies for custom post type
- Wrong generated page_name/slug on first publish of custom post type
- Stop / prevent WordPress from updating permalinks of custom post type
- custom-taxonomy/post_name instead of the default post_type/post_name
- Show custom post archive when custom post not specified
- Show custom post type relationships by taxonomy
- Create a custom php page and load it at a specific slug
- Permalinks /country/city/cpt/postname/
- Seamless permalinks between Custom Taxonomy and Custom Posts
- Custom post type and custom taxonomy with the same slug using the file page taxonomy only as directory
- Including taxonomy term before post type breaks top level pages
- Permalinks: custom post type -> custom taxonomy -> post
- How to change permalink to include custom post type
- set permalink for CPT
- How to add current custom taxonomy slug to body class
- Permalink problems with custom post type and custom taxonomy
- Custom Post Type to replace Woocommerce products – page not found error
- Ideas on how to organize a project [closed]
- Change permalinks for custom post type based on taxonomy term
- Under What Conditions Can I name my CPT the same as my CPT Page?
- Custom post type category permalinks and archive pages
- Safe to throw 404 error in request filter?
- Multiple permalinks for a single post with multiple taxonomies
- How do I set a post slug automatically based on taxonomy?
- Is there a way to use ‘publicly_queryable’ => false only on specific taxonomy term?
- How to prefix custom post type URL with custom post taxonomy term?
- Remove custom taxonamy slug with pagination
- Changing permalink of default Post with custom post
- Custom Taxonomy Archive generates 404
- Custom post type single with custom URL structure
- Customise Permalink Structure For Custom Post Types
- How to create a permalink structure with custom taxonomies and custom post types
- Pagination not working (page/2 retunring 404 page)
- Custom post type post_type_link gives “page not found” on any other custom post type
- Two CPT: one is using part of the custom rewrite slug from the other
- Custom permalink rewrite rules – how do I fix this?
- Custom permalink with custom taxonomies for custom post type
- Template hierarchy changes when custom post-type permalink leverages custom taxonomy
- Associate custom CPT with another CPT’s taxonomy and rewrite permalinks
- Post Custom & Taxonomy 404 error
- Can I override the permalink/slug on creation
- Multiple archives for cpt, taxonomies, terms
- Same permalink structure for all post types?
- How to add base permalink to custom posts?
- Hierarchical taxonomy in permalink structure
- How to change permalinks to taxonomy and post type’s posts
- taxonomy term names in custom post type permalink structure
- Can’t make permalink of CPT work
- Issue with permalinks for custom post type
- How to make nested custom post type slugs work
- Change Taxonomy Permalinks
- WP Query Post Type with same Taxonomy name
- Category / Custom Post Type permalink issue
- Adding rewrite rules to Custom Post-type mixed with Taxonomy
- “regular” pages not found after changing permalink
- How to have a dynamic slug and rendering the archive-{post_type}.php?
- Add /blog to the “post” post type url
- Different CPT permalink base on taxonomy
- Is it possible for post and custom post type to share a category base slug?
- Is it possible to use a post name in a custom post slug?
- How to change permalink structure off default posts and also CPT’s posts
- Taxonomy Archive URL + Template