REMOVE x-porfolio slug completly

I would like to change the permalink structure from http://web.com/x-portfolio/portfolio-item/
to http://web.com/portfolio-item/
Not changing the slug, removing it completely.
Thank you so much

Hello Girsanet,

Please add this block of code in the functions.php of your child theme:

// Unregistering Portfolio CPT
// =============================================================================

add_action( 'after_setup_theme','remove_portfolio_cpt', 100 );

function remove_portfolio_cpt() {   
  remove_action( 'init', 'x_portfolio_init');    
}

https://theme.co/apex/child-themes

Hope this helps.

Hello

I added the function but it removed the whole portfolio section in the backend.
Where can i manage those portfolio items now? (they doesnt appear neither in pages or posts)
I need to keep adding them their categories and keep showing them in the site. Just without the portfolio slug

Thanks so much in advance

Hi Girsanet,

In that case, please remove the code again.

As for the removal of the slug, you can only change it in Theme Options > Portfolio > CUSTOM URL SLUG but you can’t remove it as it’s the one that defines the item’s post type. I’m not saying it’s not possible but it would require URL rewrite and customization to prevent conflicts between posts with the same name. I recommend consulting it to a developer.

Example, you have created /hello-world/ in post, but you also created /hello-world/ in the portfolio. Hence it creates boundary with naming like web.com/hello-world/ and web.com/portfolio/hello-world/. Now, removing it will make the portfolio URL the same as post URL, hence conflict.

Thanks!

Thats what i was trying in this forum…

Hi Girsanet,

We’re not developers and we can’t provide custom development in the forum. What I was referring are the actual developers that could implement hard coding on your site.

What you’re trying to do is not part of the theme and never part of Wordpress, even some plugin could only remove a specific slug like the category from SEO Yoast plugin. Hence since a plugin isn’t available for your preferred setup, it’s only doable with hard coding and it’s complex.

Thanks!

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.