You may notice that by default our Portfolio post type uses portfolio slug in the URL, so when you open a single portfolio post, you’ll see this address in the URL: http://yourdomain.com/portfolio/post-name.
But what if you want to use the same name for your custom Portfolio page and show portfolio posts with Elementor widgets and add some other content? If you name your page “Portfolio”, you’ll have the same slug – “portfolio”, but it’s already assigned to default Portfolio post type in the theme and you won’t be able to edit the page with Elementor and get an error.
To fix this, you have 2 ways:
- The first one is to change your page’s slug to something like “portfolios” or “projects”, so you don’t have the same “portfolio” slug.
- The second way is to change default “portfolio” slug for our Portfolio post type, so you can use “portfolio” slug for your custom page:
1. Install the child theme.
2. Go to Appearance > Editor and open functions.php file. Or you can edit it via FTP in wp-content/themes/jupiterx-child directory.
3. Add the code in the functions.php file:
add_filter( 'register_post_type_args', 'wpse247328_register_post_type_args', 10, 2 );
function wpse247328_register_post_type_args( $args, $post_type ) {
if ( 'portfolio' === $post_type ) {
$args['rewrite']['slug'] = 'projects';
}
return $args;
}
4. Go to WP Dashboard > Settings > Permalinks and save changes without editing anything. This is needed to refresh the permalinks so that the new changes take place.
After that, you are free to use “portfolio” slug for a custom Portfolio page.