I think the solution is very easy. After registering you post type:
register_post_type( 'portfolio', $args );
flush_rewrite_rules();
flush_rewrite_rules will do it for you!
Related Posts:
- Resolve a custom post type name vs. page permalink conflict (same slug)
- Custom post type yearly/ monthly archive permalinks
- WordPress Custom Post Type is Matching on Partial Slug
- How do I redirect all 404 errors of a specific post type to another URL?
- How can I fix a slow redirect after form submit from frontend (no plugin)?
- Custom Post Types Not acknowledged for date.php template
- Bulk 301 redirect for custom post type
- How to redirect all pages of a custom post type [duplicate]
- Redirect to post with only post ID in the URL vs post_type/post ID
- How to redirect wp-admin/index.php to a custom post type?
- How to set up htaccess to redirect a particular post type or subdirectory to HTTPS?
- Redirecting when changing custom post type slugs?
- Different permalink for CPT and regular Posts/Pages but why?
- Custom Post Type without an archive page
- Delete link on single-custom.php with redirection
- Redirect page to first post in custom post type
- Custom Taxonomy Permalinks Redirection
- Create/Edit posts and auto-redirect back to listing page
- Custom post type redirected to homepage – how to debug
- 301 redirect for converted post type
- redirecting improperly after updating custom taxonomy term when referring from CPT edit page
- Child post with numeric only slug keeps redirecting to parent
- Redirect 404 page with ID in slug to associated page with same ID in slug
- redirect automatic page that serves custom posttype content
- Redirect custom post type category to other custom post type category
- Can slugs from posts and custom post types conflict?
- Some posts from custom post type to subdomains
- Changed permalink structure of CPT – should I redirect?
- Custom URL redirect in WP
- Redirect to archive is single post has a certain term assigned to it?
- Redirect to first child on Custom Post Type (without template)
- Create short URL with auto 301 redirect
- Check if user has custom post published redirection on WordPress
- Custom Post Type archive redirects to home
- rewriterule not working
- Custom taxonomy permalink without term, redirection to CPT slug
- redirect after submiting post for review
- How best to structure multiple CPTs and tax within a ‘resources’ section
- Redirect Existing Post to CPT
- Faking “Same Slug Root, Multiple Custom Post Types” with Redirects?
- Issues with static pages redirecting towards home.php
- Post Click Redirect to Custom URL instead of Single Post Page
- Pretty Permalinks with CTP and Taxonomies / Hierarchical
- Custom Function to redirect singular post if specific meta field is empty
- Custom Post Type canonical link / pagination redirecting to root
- How to redirect custom post type posts to one url with htaccess?
- How to override post-new.php with custom template
- Custom 404 redirect for a luddite
- Redirect users in first login to a dynamic link
- Redirect sub-page URLs to parent without changing URL
- How to develop custom URL redirection
- Redirect Custom Post Type after user submits update
- Redirect preview single post link to a page
- Redirect permalinks after creating custom post types
- URL Redirection From Custom Type to Posts
- Custom Post Type slug has the same Redirection entry
- Custom post type, no need for single view, plus want permalink rewrites that include hash in URI
- Custom Loop for Custom Post Type
- Custom Post Type Permalink Page Not Found
- Add custom column at custom posts list
- Adding description to archive of Custom Post Type
- Programmatically adding posts
- Conditional to modify query results
- Get rewrite slug of custom post type in template
- How can I add another option to this custom post function?
- Restrict user to only one custom post type
- How do I get the intended post type of a revision post?
- Two near-identical custom field types – one works, the other doesn’t . What can cause this?
- How to display all posts from standard posts to custom post types in a loop with pagination?
- Page template with different page and post content
- Custom Post Type with archive page but no detail page
- Custom Post Type with image gallery
- Custom post type url with category
- Display featured image from one CPT within another CPT query
- Remove slug in URL custom post type
- How to restrict author to only access one custom post type ?
- How to get a custom field value of a custom post?
- Set Custom Post Type in Widget Settings for use in Widget
- Multiple single templates?
- Template files for Custom Post Type and Taxonomy
- how to set a WP Plugin’s url
- WordPress menu with custom taxonomy
- Values from meta-box not on $_POST
- custom endpoints on Custom Post Type return 404 page not found
- Custom posttype content metabox
- Add Custom Values to Permalinks Through Custom Fields and Posts
- Custom post type items open in archives?
- Modify Publish Metabox location on CPT
- subtracting the current post form then whole loop, which is generating all CPT titles
- Edit single page from plugin
- How to shows CPT which has specific meta key?
- Manually build WP_Query
- Costum post type with costum (sub)taxonomy
- Display a post count from a custom metabox selection
- Remove Custom Taxonomy Slug only without removing Custom post type slug in permalinks
- Tags results not displaying for post types
- 2 language CPT content
- Adding custom shortcode to page leads to page without styling
- Adding post_type to the query via pre_get_posts, with infinite scroll
- Shortcode in a page to display custom posts which also have a shortcode in them