Ask your WordPress questions! Pay money and get answers fast! Comodo Trusted Site Seal
Official PayPal Seal

How to change sub url WordPress


Hello I have the CUSTOM CATEGORY 'portfolio' which shows up as

How do I REMOVE "portfolio-view" from the url?

Answers (7)


Clifford P answers:

Go to your category settings. Click to edit this category. Change the category's slug to something else.


Asad Iqbal answers:

Change your category slug.


Jatin Soni answers:

You need to change your custom texonomy slug. For that open the file where you have registers your custom post type. May be in functions.php file

and find something like <strong>register_taxonomy</strong> in that find <strong>'slug' =></strong> add your slug here

'slug' => 'portfolio-view'

If you haven't define rewrite rule than you can define with similar code below

'portfolio_category', // The name of the custom taxonomy
array( 'portfolio' ), // Associate it with your custom post type
'hierarchical' => true,
'rewrite' => array(
'slug' => 'portfolio-view', // this is for your permalink what you asked
'hierarchical' => true // Allows sub-categories to appear in permalinks
'labels' => $labels_categories


liv comments:

Will this completely remove the slug?

Jatin Soni comments:

It won't remove but define the slug what you want. You need to implement this code where you have register your Portfolio Custom Post Type. If you have any problem than send me the Portfolio CPT register code than I will modify and post it.

liv comments:

I need to completely remove the slug because the url is going to be used for vanity urls

Jatin Soni comments:

You may get solution here than..

liv comments:

I am trying the second suggestion to change it to:
add_rewrite_rule('(the-post-slug)/?$','index.php?<post type>=$matches[1]','top');

So I assume I should change it to:
add_rewrite_rule('(portfolio-view)/?$','index.php?<post type>=$matches[1]','top');

And put that in the functions.php
And then go into permalinks.

But that does not work.


Abdelhadi Touil answers:

Hi. Do you mean that you want to remove the category and its slug from your website? or just the slug? If you want to remove just the slug so why keeping the category?
I just want to understand to be able to help you.


Francisco Javier Carazo Gil answers:

Hi liv,

Remember to change portfolio-view also in second argument:

Later you have to go to this file, only introduce URL (you have to logged-in before), and job will be done:

liv comments:

Did this exactly, still does not remove the portfolio-view. Do I need to do it under another file? I also tried using this code for the "theme-function.php" and it did not work either. Are you sure:


Is the correct code?

I also tried:
add_rewrite_rule('(portfolio-view)/?$','index.php?<post type>=$matches[1]','top');

And then visiting the permalinks, none of these code lines worked.


idavinder answers:

What I understand, you want to display category 'portfolio' as

which is currently showing as

Here goes...

1. Login into your Wordpress dashboard. Then goto Pages > Categories
2. Click "Edit" button under Portfolio view category listing there.
3. In the Slug text box (2nd from top) change portfolio-view to Portfolio

See the attached screenshot, remove the selected part of the text.

liv comments:



Daniel answers:

Whenever you make these changes to the rules of the Custom Taxonomy, Category or Custom Post Types; anything that changes the link, you need to also go to your WordPress settings and click on Update Permalinks for the code changes to show in the link.

Daniel comments:

This tutorial from StackExchange might help you.

Daniel comments:

This might help: