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 Type permalink shows wrong page: homepage/index.php
- How to hook custom taxonomies to custom post types and make the permalinks work?
- Child post with numeric only slug keeps redirecting to parent
- Custom post type url with category
- Adding custom post category slug in permalink causes 404 error for pages and posts
- Permalink for a custom post type isn’t working and I don’t know why
- How Can I Change the Custom Post Type Slug to the Taxonomy Slug in the URL?
- Use same slug base for Custom Post Type posts, and multiple taxonomy terms
- How to have the same url structure for both a CPT and a Taxonomy?
- How to create custom url structure based on custom post type rewrite slug, taxonomy and category slug?
- create a subcatagory for a custom post type and out put url as posttype/subcategory/item
- 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
- How can I make the slug of the taxonomy also the slug of the custom post
- Assign same parrent Page to pages AND custom post types
- Can’t remove front from permalinks for custom taxonomy category page
- Allow duplicate slugs for custom post type with taxonomies
- Removing custom post type slug from URL
- Nested Custom Post Type or Custom Post Type Parents?
- Customize Custom Post Type URL
- 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
- Custom Permalinks with CPT and Hierarchical Taxonomies
- How to have this permalink structure: post_type/postname/custom_inner_page
- Custom Permalink Structure for Custom Post Type, Custom Taxonomy, Under a page
- Custom taxonomy returns 404
- Including taxonomy term before post type breaks top level pages
- Permalinks: custom post type -> custom taxonomy -> post
- CPT’s with landing page instead of archive – Url Rewrite?
- How to change permalink to include custom post type
- Custom post type, permalinks, taxonomies and blog posts
- Custom post type permalink tag 404
- Permalink structure with custom taxonomies and custom post type like /parent-tax/child-tax/custom-post-type-name (with no base name)
- permalink /category/post-name with custom post type and taxonomy
- Custom post type and taxonomy permalinks
- Hierarchical permalinks for custom post type and taxonomy
- set permalink for CPT
- Custom Post Type – Duplicate Page Slugs
- Custom permalink with child taxonomy terms
- Custom post type Permalinks with hierarchical Taxonomies
- Remove permalink for custom post type
- How to solve this custom post type goes to 404 page?
- Best way to specify “article type” in URL
- Template files for Custom Post Type and Taxonomy
- How do you create %post_type%/%postname%/ permalink structure?
- Problems with 404, .htaccess, permalinks and WordPress custom posts locally on Snow Leopard
- Rename a slug label
- Different slug taxonomy for two different CPT
- Can’t use pagination with custom taxonomy
- How to add current custom taxonomy slug to body class
- Using page slug in wp_query
- Listing all slugs?
- Template for custom post type when taxonomy is in the URL
- Permalink problems with custom post type and custom taxonomy
- How to filter a custom post type by custom taxonomy without 404
- How to get all posts related to particular category name on button click?
- Changing CPT slug and taxonomy already registered in parent theme
- Custom Post Type to replace Woocommerce products – page not found error
- WordPress custom permalink and archive link for custom post type
- Ideas on how to organize a project [closed]
- Enabling permalinks disables custom page template
- Need to return a string as permalink insted of str_replace
- Change permalinks for custom post type based on taxonomy term
- Under What Conditions Can I name my CPT the same as my CPT Page?
- Using page title as a link to term archive
- Custom post type category permalinks and archive pages
- Is it possible to have hierarchical taxonomy and hierarchical custom post types in one permalink?
- Custom category URL not displaying posts
- Safe to throw 404 error in request filter?
- Multiple permalinks for a single post with multiple taxonomies
- Duplicate slug/permalink issue while adding same post name
- How do I set a post slug automatically based on taxonomy?
- Custom post type and multi taxonomies + customize url
- Custom Permalink For Custom Post Type – Working Fine But Broken For Pagination
- Set priority to permalinks
- Use custom post type taxonomy between cpt slug and name
- Is there a way to use ‘publicly_queryable’ => false only on specific taxonomy term?
- Error 404 change permalink term custom term taxonomy
- How to prefix custom post type URL with custom post taxonomy term?
- How do you create pillar content pages?
- Changing CPT permalink
- Remove custom taxonamy slug with pagination
- How can I write slugs / permalinks as: custom post type -> custom taxonomy and custom post type -> custom taxonomy (one CPT and many taxo)?
- Custom post type single page returning 404 error when sharing archive url with custom taxonomy
- Changing permalink of default Post with custom post