Changing Portfolio Slug for Your Portfolio Post Type in Jupiter X

Introduction

When working with Jupiter X, you may want to personalize your website by using a custom slug for your portfolio items. By default, portfolio post types have the URL structure:

http://yourdomain.com/portfolio/post-name

However, if you wish to use 'portfolio' as the slug for your main portfolio page, you will encounter a conflict. This can lead to errors when trying to edit the page with Elementor.

This guide will show you how to change the default portfolio slug while avoiding errors.


Warning Before Making Changes

⚠️ Editing core theme files incorrectly may break your website. Always create a backup before making changes. If you are unfamiliar with editing theme files, consider using a plugin like Custom Post Type UI or Permalink Manager Lite to modify the slug safely.

⚠️ It is strongly recommended to use a child theme when modifying theme files. This ensures that your changes are not lost when updating the main theme.


Changing the Default Portfolio Slug (Code-Based Solution)

Step 1: Open the Theme File Editor

  1. Go to WordPress Dashboard > Appearance > Theme File Editor.
  2. Alternatively, connect via FTP and navigate to wp-content/themes/jupiterx-child/ .

Step 2: Modify the functions.php File

  1. Locate the functions.php file inside the JupiterX Child Theme.
  2. Scroll to the bottom and insert the following code:
add_filter( 'register_post_type_args', 'change_portfolio_slug', 10, 2 );
function change_portfolio_slug( $args, $post_type ) {
    if ( 'portfolio' === $post_type ) {
        $args['rewrite']['slug'] = 'projects'; // Change 'projects' to your preferred slug
   
	// Change labels in the WordPress admin dashboard
        $args['labels']['name'] = 'Projects';
        $args['labels']['singular_name'] = 'Project';
        $args['labels']['menu_name'] = 'Projects';
        $args['labels']['add_new'] = 'Add New Project';
        $args['labels']['add_new_item'] = 'Add New Project';
        $args['labels']['edit_item'] = 'Edit Project';
        $args['labels']['new_item'] = 'New Project';
        $args['labels']['view_item'] = 'View Project';
        $args['labels']['search_items'] = 'Search Projects';
        $args['labels']['not_found'] = 'No projects found';
        $args['labels']['not_found_in_trash'] = 'No projects found in Trash';
		$args['labels']['all_items'] = 'All Projects';
	}
    return $args;
}

Step 3: Flush Permalinks

After adding the code, go to Dashboard > Settings > Permalinks and click Save Changes without making adjustments. This refreshes the permalink structure.


Troubleshooting Common Issues

1. Page Not Found (404 Error) After Changing Slug

✅ Solution: Go to Settings > Permalinks, then click Save Changes to refresh permalinks.

2. Custom Portfolio Page Not Displaying Correctly

✅ Solution: Ensure that no Portfolio Archive Template is overriding your custom page.

3. Website Breaks After Editing functions.php

✅ Solution: Access your site via FTP, open functions.php , and remove the code you added.

4. SEO Impact of Changing Slugs

✅ Solution: If your portfolio pages are already indexed, use a 301 redirect from the old URLs to the new slug using an SEO plugin like Rank Math or Yoast SEO.


Conclusion

By following this code-based method, you can successfully change your portfolio slug in Jupiter X. If you’re not comfortable editing theme files, using a plugin-based method is a safer option.

🚀 Need help? Create a support ticket for assistance!

Did this answer your question? Thanks for the feedback There was a problem submitting your feedback. Please try again later.