You can tell WordPress what template file to use with the template_redirect
hook.
add_action( 'template_redirect', 'wpse98738_taxonomy_redirect' );
function wpse98738_taxonomy_redirect() {
if( 'x' == $customtax && 'y' == $category_name ) {
include( get_template_directory() . '/taxonomy-customtax.php' );
// if you're using a Child Theme, use the following line instead:
// include( get_stylesheet_directory() . '/taxonomy-customtax.php' );
exit; // so that WP quits looking for templates to load
}
}
Reference
Codex pages for:
Related Posts:
- Template Hierarchy: confused with index.php, front-page.php, home.php
- How to use a specific category archive index as the site front page?
- Overriding default template if page slug and post type are same
- Change Page Template Based on Category
- Load custom template for specific GET parameter
- where is the code that executes the template hierarchy?
- WordPress Page Hierarchy
- How to force sub-product-category to use the parent category template
- How to determine the template loaded when you are not an Admin?
- Template hierarchy override
- What is the difference between the “Main Index Template”(index.php) and HomePage(front-page.php)
- About template hierarchy
- Front-Page.php and Index.php
- Displaying a custom post type and an archive page
- Which page is referring to *all posts by author*?
- How to determine top level template file in functions.php? [duplicate]
- Get the current hierarchy php page
- Loading partial templates with AJAX/PJAX
- Different template for subcategories
- Different templates for parent and children categories/taxonomies
- How to use same theme template for multiple taxonomy terms?
- Custom Post Type with Nested Taxonomy and Template Files
- Store Page Template Files in a Subfolder
- Template Hierarchy for get_header()
- WooCommerce Template overriding not working with woocommerce.php
- Load template file without a post type
- WordPress Template Hierarchy
- Any tag pagination page (except the 1st page) loads index.php template instead of tag.php
- Where to put my global functions?
- What should I put on my index.php?
- Rewrite URL for only archive page (custom post type)
- Templating of a specific post ID
- WordPress Theme Development: How to redirect templates the right way?
- Template Hierarchy tag-{slug}.php directory
- Custom post type not using it’s own single-postname.php
- Display Categories, Sub-categories, and Sub-sub-categories on separate pages
- Inheritance of parent theme plugin files in a child theme
- Custom post type templating problem
- How to make use of WP templates within a nested site structure?
- Single page site with history.js
- Custom post type showing index.php
- redirect automatic page that serves custom posttype content
- How To Pass Current Post Type ID from Single Template To Custom Page Template
- How do I check if the user is on a taxonomy term parent, child or grandchild page?
- WordPress Doesn’t Generate Taxonomy Archive
- CPT Template Not Showing – Getting 404
- Is there a template file to list all terms of a given custom taxonomy?
- Categories overview that links to page displaying posts
- Custom templates vs page-slug
- rewrite taxonomy-{taxonomy}-{term}.php terms
- the_excerpt() in content.php and get_template_part() in single.php
- Override Taxonomy Template
- Use one template only for custom post type archives?
- Custom Empty Results page for my Custom Post Type
- single.php with different look by category
- Taxonomy-$taxonomy-$term not working
- Use meta boxes inside an archive page template for Woocommerce
- Use different template than author.php for get_author_posts_url()
- Restricting page templates by blog_id in multisite network
- Custom Post Type Template Hierarchy – Single post template
- Can I assign a Folder for Post Formats, without it affecting WordPress’ fallback/hierarchical system?
- What Must to Display the “mysite.com/category” URL?
- Creating page & post templates without template file
- Template hierarchy: how to let category.php conditionally-load archive.php?
- Different Loop for tag pages?
- The best way to create pages like an ‘about’, ‘contact’ and etc [closed]
- Assigning custom page templates to a static blog page
- WordPress Page doesn’t load the template selected
- localizing variable on front-page.php template fails but succeeds on single page and taxonomy archive
- Using index.php as page template
- Overwriting TwentyTwelve template file with child theme template, but lower in the hierarchy
- Organize template parts and page templates in folders in regards of template hierarchy
- Help Understanding Template Hierarchy
- Archive page of taxonomy returns a 404 error
- Is it possible to set archive.php instead of index.php to display blog?
- Prioritise Pages over Taxonomy Term Root Archive, but not Taxonomy Term Child Archives
- WordPress custom pages in a folder
- User role templates
- Media item permalink goes to source file instead of attachment.php
- BuddyPress : how can I call the template WordPress would have chosen (template hierarchy)?
- How can I make custom page templates work on child theme?
- Templating advice sub posts of a CTP
- which template should I use for single category post?
- Specific template for subcategory of custom taxomy
- More than one search results page template for two searches on site
- Different templates for each category level
- Different taxonomy.php for different custom post types
- How to put articles under a /blog directory?
- How to add dynamic content to posts page, archive, taxonomies, search, author, etc?
- Use different file includes for single.php
- Page Templates Used in Custom Post Type
- Needed to change slug to access page
- How to display custom taxonomy
- URL Rewrite Adjustment for Custom Post Type causes template to revert to index.php
- Template files not working for archives and categories
- Custom Taxonomy Template Variables Available?
- Archive for custom fields?
- Custom taxonomy meta fields
- Template hierarchy html with taxonomy in 6.2
- Unload templates; disable parent Template Parts using only “theme.json”