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
- How to display posts from home page in blogs in category wise
- Custom taxonomy not showing up when adding a new custom post type
- Custom Posttype Inheritance (and url structure)
- Create an archive page for custom taxonomies
- Rewrite permalinks for custom posttype and custom taxonomy
- How to check if last uri segment is a custom post type or taxonomy term?
- Getting Post ID from slug during init
- Rewrite custom post & taxonomy to share same URL path
- Custom Post Types, Custom Taxonomies and Permalinks ?
- Order WordPress Custom Taxonomy Pages & Pagination Not Working
- Have a Custom Post Type index page display taxonomy items instead of posts
- add category name to permalinks on product page /category-name/product-name
- Multiple (two) category postings on the same page.
- permalink /category/post-name with custom post type and taxonomy
- Slug for custom post type
- WordPress Custom Post Type – Rewrite Query
- Redirect User From Registration Page To CPT (profile page) with custom url
- Custom post type 404 error on “default” or “numeric” permalinks
- I want to rewrite the URL of a specific post with a specific custom field to easily analyze in Google Analytics
- Taxonomy doesn’t follow slug permalink structure
- WordPress Permalink Custom Post type
- Taxonomy count per Post type
- How to display elements of different post types?
- How to display only taxonomies of custom post type in a page?
- Custom role can’t create permalink
- Problem with Custom Post Types, Taxonomy, permalink, Archive
- How can I rename custom taxonomy if multiple custom post type have the same taxonomy name?
- Custom Post Types Do Not work on this permalink setting https://somedominaname.com/%category%/%postname%/