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
- Custom Taxonomy as checkbox or dropdown
- Taxonomy: Why ‘with_front’ => false DOES NOT WORK?
- Custom Post Type Permalink / Rewrite not working immediately
- Custom Taxonomy as Dropdown in admin
- Change slug of registered custom post type in child theme
- Templates for Custom Post Types and Custom Taxonomies
- How to achieve this permalink -> category-name/custom-post-type-name/post-name
- Custom permalinks
- Add links to post categories and taxonomies in wysiwyg link modal?
- Prepend meta_value to permalink of post
- Custom Permalinks for Custom Post Types and Taxonomies
- Query multiple taxonomy in Custom Post Type
- Maintaining WP_Query Relation Among CPT, Custom Taxonomy, Permalinks- CPT UI
- Custom post type category, taxonomy and URL rewrite problem
- Listing taxonomies from custom post type
- Permalinks for Taxonomy and Custom Post Type
- Programmatically adding posts
- How to create a permalink structure with custom taxonomies and custom post types like base-name/parent-tax/child-tax/custom-post-type-name
- removing custom tax & CPT slug, adding taxonomy term in front of custom type
- Order WordPress Custom Taxonomy Pages & Pagination Not Working
- multiple url slug for single custom post type
- How do I fix permalinks for custom post types that has the same slug as a page?
- Why does wordpress keep adding postname to my CPT’s permalink in the end?
- How to display custom taxonomies with links in filter menu?
- Custom post type url with category
- Adding custom post category slug in permalink causes 404 error for pages and posts
- How to Filter custom post type by taxonomy?
- Limit amount of posts made within a custom taxonomy
- Issue on Creating Custom Tax Term Dynamically From Another CPT Meta-box On Publish
- list taxonomies from a custom post type
- Taxonomies relations
- Full Custom Post Type List Organised by two Taxonomies
- Adding custom taxonomy in same menu place with two custom post types
- 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
- Custom post type Permalinks with hierarchical Taxonomies
- Template files for Custom Post Type and Taxonomy
- Can’t use pagination with custom taxonomy
- Hide specific taxonomies from a taxonomy list using ‘get_object_taxonomies’
- Using page slug in wp_query
- Custom taxonomy (categories) on custom post type return no results
- Targeting categories in custom fields
- Listing all slugs?
- Rewrite custom post type with taxonomy
- My custom taxonomy is only displaying 1 of 3 terms
- Custom Taxonomy Terms in Menu lead to which page?
- How to display posttypes and taxonomy in standard posts, not in a separate label?
- Get the taxonomy value in the post loop inside the archive page
- How to show related posts of category on post within custom posttype
- Error 404 change permalink term custom term taxonomy
- WP_Query for custom taxonomies showing posts from non-specified terms?
- Listing all custom posts having a specific taxonomy whatever the terms
- Display custom tax in “while” loop
- Categories manage
- Showing taxonomies with terms that are attached to custom post
- Custom Taxonomy page redirecting to 404 page
- Pretty permalink structure with multiple (AND OR) taxonomies
- Displaying WordPress posts from post and custom post type in custom taxonomy
- Custom post type taxonomy template and URL confusion
- Getting a 404 on single custom post type page when using rewrite on a custom taxonomy
- Custom Taxonomy is disabled on Edit page
- Override “Parent” input for custom taxonomy
- How can I add a “fake” parent into the permalink?
- Custom Post Type Categories Not Maintaining URL structure any more
- Add category slug as class attribute in a link array
- How to display elements of different post types?
- Add taxonomy to custom post type archive
- How to display only taxonomies of custom post type in a page?
- Check if taxonomy is attached to at least one post in a post-type
- Looping taxonomy in taxonomy?
- Custom posts and custom taxonomies for many products and categories?
- Permalinks Works for Custompost type but not with pages Why?
- Problem with Custom Post Types, Taxonomy, permalink, Archive
- How do i get the taxonomy term name on the CPT archive page?
- How to add to taxonomies to a post type
- Filtering custom post types using category taxonomy
- Different CPT permalink base on taxonomy
- Custom post type Premalinks main page and details page
- Permalinks for Custom Post Types and Taxonomies