This worked for me (tested):
add_action( 'init', static function () {
register_taxonomy( 'portfolio-work', 'post', array(
'hierarchical' => true,
'labels' => array(
'name' => 'Portfolio Works',
'singular_name' => 'Portfolio Work',
),
'rewrite' => array(
'slug' => 'work',
'with_front' => false,
),
) );
} );
Then created new pages titled “Blog” (slug: blog) and “Work” (slug: work), and was able to access the pages and taxonomy pages:
- Permalinks:
/blog/%postname%/ - Page “Blog”:
http://wpse417869.local/blog/ - Post “Hello world!”:
http://wpse417869.local/blog/hello-world/ - Page “Work” (taxonomy index):
http://wpse417869.local/work/ - Term “Portfolio Work A” in “Portfolio Work” taxonomy (term index):
http://wpse417869.local/work/portfolio-work-a/
Related Posts:
- Remove Taxonomy Slug when No Taxonomy is Assigned to Custom Post Type?
- How to change permalink structure for custom post type and it’s taxonomies?
- How do I append multiple taxonomies to the URL?
- Custom Post type & Taxonomy URL structure
- Slug Formatting : Acceptable Characters?
- Disable permalink on custom post type
- Combining Multiple Taxonomies in one URL
- Taxonomy term in permalink
- Change slug of registered custom post type in child theme
- Dynamic taxonomy in permalink made all other posts NOT FOUND?
- Disable Single Post View for Specific Taxonomy on Custom Post Type
- How to achieve this permalink -> category-name/custom-post-type-name/post-name
- Taxonomy page returns 404 page not found
- Prepend meta_value to permalink of post
- Priority for Categories, Tags, Taxonomies, Posts, Pages and Custom Posts with same url
- Remove Slug from Custom Post Type results in 404
- Disable WordPress Recognizing Path as Attachment
- 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
- Can’t edit Custom Post Type slug/permalink
- Custom Permalink with Dynamic Taxonomy for Custom Post Type – Works, but breaks other permalinks
- Custom Taxonomy breaking pages permalinks
- Permalinks for Taxonomy and Custom Post Type
- Custom Post Type with two hierarchical Custom Taxonomies: strategy to generate best permalink structure
- Automaticly add slug to posts
- 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?
- Wrong generated page_name/slug on first publish of custom post type
- Remove post type slug of all post types from permalinks
- Stop / prevent WordPress from updating permalinks of custom post type
- Update permalinks when new category added to custom post type taxonomy
- Child post with numeric only slug keeps redirecting to parent
- Permalink for a custom post type isn’t working and I don’t know why
- Assign same parrent Page to pages AND custom post types
- Create a custom php page and load it at a specific slug
- How to organize hierarchical structure in custom post type with taxonomy (like with categories)
- Custom Post Type – Duplicate Page Slugs
- Remove permalink for custom post type
- How do you create %post_type%/%postname%/ permalink structure?
- Rename a slug label
- Custom Post Type Advanced Slug
- Changing CPT slug and taxonomy already registered in parent theme
- Custom Post Type to replace Woocommerce products – page not found error
- Custom Post Type with modified permalink structure results in 404
- Need to return a string as permalink insted of str_replace
- Under What Conditions Can I name my CPT the same as my CPT Page?
- Using page title as a link to term archive
- How to use taxonomy term as permalink folder
- Duplicate slug/permalink issue while adding same post name
- Custom permalink structure for custom post types including multiple taxonomy
- Change permalink incrementor into pseudo-subdirectory
- Custom post type URL structure with site.com/custom_taxonomy_slug/post_name
- Two CPT: one is using part of the custom rewrite slug from the other
- WordPress page not showing up – replaced with last 10 posts?
- Custom permalink rewrite rules – how do I fix this?
- Permalinks for a custom post type – with a page template (custom query) and taxonomy archive
- Can I override the permalink/slug on creation
- Get full control over custom post type url
- Custom Post Type Categories Not Maintaining URL structure any more
- Add category slug as class attribute in a link array
- Remove Custom Taxonomy Slug only without removing Custom post type slug in permalinks
- Can’t make permalink of CPT work
- How to make nested custom post type slugs work
- Problems with custom post type and hierarchical permalinks
- Permalink for regular posts “/blog/”
- Single and Archive Pages with Custom Post Type
- Hide custom post type slug url from search engine [closed]
- Custom post type Premalinks main page and details page
- Is it possible for post and custom post type to share a category base slug?
- How to change permalink structure off default posts and also CPT’s posts
- Taxonomy Archive URL + Template
- Custom Taxonomy as checkbox or dropdown
- How to get custom post type label and singular label from its slug?
- How to remove /blog/ prefix for custom post types in permalinks?
- Templates for Custom Post Types and Custom Taxonomies
- Custom permalinks
- Custom post type permalink changing itself every other change
- Add links to post categories and taxonomies in wysiwyg link modal?
- Query multiple taxonomy in Custom Post Type
- Maintaining WP_Query Relation Among CPT, Custom Taxonomy, Permalinks- CPT UI
- Rewrite on custom post type permalink not working?
- Custom post type with specific category structure
- Custom Post Type and Taxonomy combination
- Exclude specific taxonomy term when using wp_get_post_terms
- Get Post Primary Category
- How to check the terms in single custom post type template
- How can I move a custom taxonomy and its data from one post type to another?
- Permalinks not working for custom taxonomy on custom post type
- Rewrite slug for CPT
- Custom Taxonomies not appearing in Admin
- Using Same Slug With Multiple Post Types
- Does WordPress consider a post name unique if that same post name is in multiple Post Types?
- Can taxonomies of custom post types be used with category actions?
- Remove the parent slug in a CPT URL
- Custom post type as home page with custom url
- WordPress Doesn’t Generate Taxonomy Archive
- Replace taxonomy permalinks
- Parent Page and Breadcrumb URL’s for Custom Post Types Not Working
- CPT’s with landing page instead of archive – Url Rewrite?