With helpful tips from Milo, I was able to remove the taxonomy slug when no taxonomy is assigned to the custom post type by adding the following code to the updated functions above:
add_filter( 'request', 'project_request_filter' );
function project_request_filter( $request ){
if( array_key_exists( 'project' , $request )
&& ! get_term_by( 'slug', $request['project'], 'project' ) ){
$request['set'] = $request['project'];
$request['name'] = $request['project'];
$request['post_type'] = 'set';
unset( $request['project'] );
}
return $request;
}
Related Posts:
- How do I append multiple taxonomies to the URL?
- Custom Post type & Taxonomy URL structure
- Combining Multiple Taxonomies in one URL
- Dynamic taxonomy in permalink made all other posts NOT FOUND?
- Remove taxonomy slug when not assigning taxonomy with custom post types
- Custom Post Type: How to display all of same taxonomy?
- Remove “-2” from a Toolset Types URL with the same post name
- 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
- Rename a slug label
- Custom Post Type Advanced Slug
- Changing CPT slug and taxonomy already registered in parent theme
- Using page title as a link to term archive
- Duplicate slug/permalink issue while adding same post name
- 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
- 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?
- Taxonomy Archive URL + Template
- How to get taxonomy category in permalink for each taxonomy OR How to give a parent page to a given taxonomy?
- How to hook custom taxonomies to custom post types and make the permalinks work?
- Categories of custom taxonomy don’t show any posts
- How to display custom taxonomies with links in filter menu?
- Custom Taxonomy back-end customizations
- Child post with numeric only slug keeps redirecting to parent
- Taxonomy custom post type URL
- 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 to Filter custom post type by taxonomy?
- How Can I Change the Custom Post Type Slug to the Taxonomy Slug in the URL?
- Is it possible to have dedicated page for parent/child taxonomy?
- 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
- Why are taxonomy terms not saving when using custom meta boxes with radio button taxonomy selectors?
- Get related posts of child term of custom post type
- Limit amount of posts made within a custom taxonomy
- 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
- Issue on Creating Custom Tax Term Dynamically From Another CPT Meta-box On Publish
- 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
- list taxonomies from a custom post type
- Display a grid of taxonomy terms at root taxonomy page
- Removing custom post type slug from URL
- Nested Custom Post Type or Custom Post Type Parents?
- Customize Custom Post Type URL
- limit value taxonomy based on previous taxonomy value wordpress
- 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
- How do I display the taxonomy for a custom post type in an array
- Custom Permalinks with CPT and Hierarchical Taxonomies
- How to conditionally redirect to the post from a taxonomy page?
- How do I check if the user is on a taxonomy term parent, child or grandchild page?
- How do I display the grand child items of a taxonomy term?
- Taxonomies relations
- Is it better to use WordPress Custom Post Types or Taxonomies?
- Full Custom Post Type List Organised by two Taxonomies
- WordPress Doesn’t Generate Taxonomy Archive
- How to have this permalink structure: post_type/postname/custom_inner_page
- Suggested Post and Taxonomy structure
- Custom Permalink Structure for Custom Post Type, Custom Taxonomy, Under a page
- Custom taxonomy returns 404
- Custom post with more than one custom taxonomy
- Get the taxonomy of a post hierarchically
- Replace taxonomy permalinks
- Adding custom taxonomy in same menu place with two custom post types
- How to make custom taxonomy into drop down select in a custom metabox
- 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
- How to get list of taxonomy slugs ordered parents>childs?
- 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
- How do I share categories across multiple post types?
- Hierarchical permalinks for custom post type and taxonomy
- How to organize hierarchical structure in custom post type with taxonomy (like with categories)
- Multiple tag cloud filtering
- Get url.com/post_type/taxonomy/term work!
- set permalink for CPT
- Custom Post Type – Duplicate Page Slugs
- How to display products name in a non-alphabetical order, in a custom field (taxonomy)?
- Taxonomy in URL
- Custom permalink with child taxonomy terms
- Custom post type Permalinks with hierarchical Taxonomies
- Different Category system needed for the Custom Post Type
- Custom Post Type Category Link
- Custom Post type category pages template and loop