While I don’t see particular problem with this, you do kind of break out of code flow at early point.
I would try to go for setting query to is_404
instead and let it reach template processing and 404 in template hierarchy naturally.
Related Posts:
- Custom Permalink with Dynamic Taxonomy for Custom Post Type – Works, but breaks other permalinks
- custom post type and custom taxonomy url conflict
- Custom taxonomy in URL showing 404
- Custom post type permalink tag 404
- Hierarchical permalinks for custom post type and taxonomy
- How to solve this custom post type goes to 404 page?
- How to filter a custom post type by custom taxonomy without 404
- 404 Error On Custom Taxonomy Pages 2, 3, etc
- How to create a permalink structure with custom taxonomies and custom post types like base-name/parent-tax/child-tax/custom-post-type-name
- Remove taxonomy slug from a custom hierarchical taxonomy permalink
- Getting hierarchical custom post type permalinks to work just like pages
- Shouldn’t this be easy?! Custom post type/custom taxonomy permalink
- Custom Post Type Permalink / Rewrite not working immediately
- Custom Post type & Taxonomy URL structure
- Combining Multiple Taxonomies in one URL
- Why does a custom post type need the ”hierarchical’ args setting?
- Templates for Custom Post Types and Custom Taxonomies
- How to modify URL structures in custom post types and taxonomies or terms
- Custom permalinks
- 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
- Add links to post categories and taxonomies in wysiwyg link modal?
- Custom Permalinks for Custom Post Types and Taxonomies
- Custom Post Type with Nested Taxonomy and Template Files
- Semantic URL Custom Post Type and Taxonomies permalinks
- How to rewrite custom post type URL for multiple depths instead of one specific depth
- Maintaining WP_Query Relation Among CPT, Custom Taxonomy, Permalinks- CPT UI
- Custom post type category, taxonomy and URL rewrite problem
- Custom Taxonomy archive returns 404
- Custom Post Type: How to display all of same taxonomy?
- Remove “-2” from a Toolset Types URL with the same post name
- Remove Taxonomy Slug when No Taxonomy is Assigned to Custom Post Type?
- Include taxonomy slug in url?
- Custom permalink – append taxonomy name and term name at the end of permalink
- Add hierarchical taxonomy to permalink for custom post type
- Custom post types, taxonomies, and permalinks
- How to specify URLS for custom posts & taxonomies
- Custom post types, taxonomies, and permalinks
- How To Create A Custom Taxonomy 404 Page
- Permalinks not working for custom taxonomy on custom post type
- custom permalinks based on taxonomies for custom post type
- Custom Post Type permalink shows wrong page: homepage/index.php
- Custom post type url with category
- 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
- 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
- Custom post URL 404 error
- Parent Page and Breadcrumb URL’s for Custom Post Types Not Working
- Permalinks: custom post type -> custom taxonomy -> post
- CPT’s with landing page instead of archive – Url Rewrite?
- Custom post type / taxonomy rewrite archive page 2 gives 404
- Custom post type pagination 404
- Best way to specify “article type” in URL
- Template for custom post type when taxonomy is in the URL
- One Custom post type 404’s others don’t
- Custom post type permalink returns 404 when set to private
- Custom post type slug 404
- Ideas on how to organize a project [closed]
- Change permalinks for custom post type based on taxonomy term
- Is it possible to have hierarchical taxonomy and hierarchical custom post types in one permalink?
- Permalinks not working (404) for the ‘item’ post type
- Custom category URL not displaying posts
- Multiple permalinks for a single post with multiple taxonomies
- either single-{custom}.php 404’s OR /taxonomy/ 404’s – custom post type and taxonomy permalinks
- Duplicate slug/permalink issue while adding same post name
- Error 404 change permalink term custom term taxonomy
- How do you create pillar content pages?
- Custom post type single page returning 404 error when sharing archive url with custom taxonomy
- Permalinks: custom post type -> custom taxonomy -> custom sub taxonomy -> post
- Pretty Permalinks with CTP and Taxonomies / Hierarchical
- Customise Permalink Structure For Custom Post Types
- % encoded URL giving 404 error in WordPress
- Some permalinks on Apache/localhost development setup return 404’s when set to anything other than plain permalinks
- Issue with Custom Post Types and Permalinks
- Custom post type URL structure with site.com/custom_taxonomy_slug/post_name
- Making permalink for custom post type/custom taxonomy. Stuck with 404 in the single post
- Custom permalink with custom taxonomies for custom post type
- 404 error next-page [2] PageNavi custom type taxonomy
- Pretty permalink structure with multiple (AND OR) taxonomies
- Change the url of a custom post type to include taxonomy
- How to have permalink structure based on taxonomy terms
- Multiple post types or single post type with category taxonomy?
- How can I add a “fake” parent into the permalink?
- Permalinks when using Custom Post Type with static page for archive
- How to change permalinks to taxonomy and post type’s posts
- Adding 2 CPT with multiple custom taxonomies to permalinks
- Parent cpt/child custom post type URL permalink relationship
- Custom Post Type Permalinks Problem
- WordPress Custom Permalink Structure with Custom Post Type and Taxonomies
- Add taxonomy to custom post type archive
- Permalink for Custom Post Types
- Remove slug from Custom Category Permalink + dual-category permalinks
- Different CPT permalink base on taxonomy
- Hide custom post type slug url from search engine [closed]
- Is it possible for post and custom post type to share a category base slug?
- Permalinks for Custom Post Types and Taxonomies