Hello I have the CUSTOM CATEGORY 'portfolio' which shows up as mywebsite.com/portfolio-view/
How do I REMOVE "portfolio-view" from the url?
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
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.
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..
I am trying the second suggestion to change it to:
So I assume I should change it to:
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:
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:
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:
And then visiting the permalinks, none of these code lines worked.
What I understand, you want to display category 'portfolio' as mywebsite.com/portfolio/
which is currently showing as mywebsite.com/portfolio-view/
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.
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.
This tutorial from StackExchange might help you.
This might help: http://wpjourno.com/custom-post-types-custom-taxonomy/