Note that the url-rewriting doesn’t directly determine the template used. A pretty url is interpreted as a query and then that query determines what template is used based on the template hierarchy.
So only need one rule:
example.com/localdeals/myterm => example.com/?location=myterm
WordPress will look for the template taxonomy-location-myterm.php and use that (if it exists) or otherwise fallback to taxonomy-location.php
To add the above rule, when you register your taxonomy:
register_taxonomy('location','post',array(
'hierarchical' => false,
...
'query_var' => true,
'rewrite' => array( 'slug' => 'localdeals' ),
...
));
(you will need to flush these rules once after changing these – if this is for a plug-in/theme, only flush on activation/de-activation). Otherwise, just visit Settings > Permlinks page, and they’ll be flushed :).
Related Posts:
- Custom Taxonomy Endpoint Pagination using paginate_links()
- Can’t get a custom template taxonomy page to display
- Removing taxonomy base using WP rewrite
- Custom taxonomy on permalink
- How to enable hierarchical permalinks for hierarchical taxonomies
- Custom taxonomies, with custom rewrites/slug, AND loading a taxonomy archive template from a plugin
- term_link() filter or rewrite and howto?
- WP redirects pretty permalink to query string
- Add parent/child taxonomy to custom post type url
- How do I get WordPress URL rewrites into Sitemap?
- Create multiple rewrite endpoints for custom taxonomy archive
- Taxonomy with_front causes all
- 404 error- issues with pages after adding custom rules for posts
- How to overwrite registered taxonomy url from vendor plugin in child theme
- How to add a Rewrite Rule / Category Structure
- Custom permalinks with hierarchical taxonomy – getting PHP warning
- Taxonomy Pagination Rewrite
- How do I modify taxonomy term slugs dynamically?
- Permalink help with default Posts and custom Taxonomy
- how to change permalinks format for pagination?
- Custom Taxonomy and Rewrite URL
- Rewrite Rules returning wrong data
- Rewrites with hierarchical taxonomies in permalink
- Rewrite rules for varying nested terms of custom taxonomy
- Taxonomy Rewrite Rules Redirecting Instead of Masking
- How to change url for taxonomy pages?
- Why is flush_rewrite_rules mandatory after registering custom taxonomies?
- Rewrite Search URL Permalink For CPT Custom Taxonomies
- How to change Custom Permalink for Taxonomy? (remove the slashes from term-slug)
- How do I get the correct URL?
- How to replace custom post type with custom taxonmy in permalinks
- How to structure all custom-taxonomy with three verbs(a,b,c) and route them accordingly?
- True or F False Setting of ‘with_front’ Parameter of Rewrite Is returning Exact Same result
- Multiple Custom Taxonomy Rewrite
- Rewriting url for multiple Taxonomies and Custom Post Type
- Custom rewrite url structure for several custom taxonomy (NOT pos_type)
- Hierarchical taxonomies in permalink cause 404 for sub term archive
- Permalink structure not working with Custom Taxonomy (URL like ./taxonomy/category/postname)
- add_rewrite_rule using custom taxonomy and year
- If term and page have the same slug, how can I view the term archive?
- rewriting for custom taxonomy rewrite
- Filter posts and custom taxonomy using add_rewrite_rule
- Rewrite URL for a specific taxonomy [duplicate]
- Two taxonomies with the same slug
- Is there a way to create a single rewrite rule to handle multiple variables depending on what is present?
- Adding Category to Child Posts Permalink
- WordPress taxonomy radio buttons
- Custom taxonomy, get_the_terms, listing in order of parent > child
- Inserting a term into a custom taxonomy
- Count posts in custom taxonomy
- Get main parent categories for a product
- Echo Custom Taxonomy Field Values Outside the Loop
- Taxonomy Relationships
- How to display posts from a single category within a custom taxonomy
- Handling AJAX with custom taxonomy custom fields on add
- Custom taxonomy parent from another taxonomy
- How to extract url from get_the_term_list?
- Add hierarchical taxonomy to permalink for custom post type
- pre_get_posts Tax Query not working for custom author page
- Custom Taxonomy template not showing
- Custom taxonomy [year] is directing to yearly archive
- Alter post order on taxonomy template
- Display Taxonomy Terms in an option tag with value being the slug
- orderby meta_value breaks taxonomy term archives
- Category slug field missing with registered custom taxonomy
- How to show the a custom taxonomy term on single post metadata
- Automatically Give All Custom Post Types a Pre-Set Category [duplicate]
- Custom Post Type Taxonomy not showing
- Sort order by slug for looped child terms of custom taxonomy
- Simple Filter between multiple taxonomys
- get the taxonomies terms associated with users
- Add success message to category add screen
- Website loading slowly – Advanced Custom Fields images
- How to check if a post has at least 2 terms from a custom taxonomy attached?
- Removing custom taxonomies from the admin menu
- Custom post type Category Display
- Custom Taxonomy template not display
- Modifying rewrite rules to use /category//
- pre_get_posts post_meta event
- How can I add a custom permalink to a term?
- Custom taxonomy display name issue
- How can I get Taxonomy Images to work with ‘orderby’ argument?
- How do I hide a term from non-admin users in get_the_term_list?
- Query Results not being displayed please help
- Can I output a custom taxonomy as a submenu in the site navigation menu?
- Custom taxonomy throw error 404
- using wp_insert_term to create custom terms for a custom taxonomy from frontend form,
- Get Terms of custom Taxonomy of products with certain Product Category
- Custom dropdown list taxonomy not saved
- WordPress taxonomy terms archive template help
- How to get all the terms from a custom hierarchical taxonomy via REST api?
- Remove taxonomy name and add .html extension in the custom taxonomy term URL
- How to build overlapping custom post_type and taxonomy rewrites without conflicts?
- Pagination for Custom Taxonomy
- Register custom taxonomy from a Advenced custom field option page
- WordPress doesn’t respect the template hierarchy?
- register and insert category manually
- Multiple category lists on one page
- Taxonomy archive link from term id
- Add Gutenberg editor to edit taxonomy (category) page