Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

Possible Duplicate:
Remove slug in taxonomy url

I'm using proreview theme and it uses a custom taxonomy called "review-cats"

In of this

www.domain.com/review-cats/clothing

I want

www.domain.com/clothing

I've been trying to find a solution for 2 days not ...

relevant code

register_taxonomy(

"review-cats",

array("reviews"), array( "hierarchical" => false, "label" => "Categories", "singular_label" => "Category", "rewrite" => true ) );

share|improve this question

marked as duplicate by toscho Jul 31 '12 at 5:08

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

add comment

1 Answer 1

This is not possible out of the box, nor is it advisable, and for good reason. If you really did want to do this you would need to hack the core files.

Why it's not a good idea:

  • WordPress does not check for Permalink clashes between taxonomy term slugs and page slugs
  • Say you have a page with the slug clothing, and a taxonomy term clothing, and you go to example.com/clothing ? Does the user want the page? Or the term? There's no way of telling!

Doing this is opening a can of worms for yourself.

Instead I recommend you use the rewrite parameter to redefine the slug as 'reviews'. Note that setting the slug to '' will not do what you desire, even though it seems like it should.

e.g.:

register_taxonomy(

"review-cats",

array("reviews"), array( "hierarchical" => false, "label" => "Categories", "singular_label" => "Category", "rewrite" => array( 'slug' => 'reviews') ) );

I also recommend you use a generator to create your taxonomy and post type code. Go here:

http://themergency.com/generators/

share|improve this answer
    
thanks for the quick answer how is it possible for standaard categories to remove the slug? there has to be some way... –  Bram Apr 23 '12 at 11:14
    
I strongly advise against this. It would make more sense logically and semantically not to do this. You gain nothing by doing this, and you leave yourself with new problems where before you had none. If for whatever reason this is necessary and unavoidable, please explain –  Tom J Nowell Apr 23 '12 at 11:41
    
for Seo reasons, Its easier to get google rank on keyword search of clothing when its www.domain.com/clothing then www.domain.com/review/clothing –  Bram Apr 23 '12 at 12:16
    
hmmm I've seen no evidence at all that this actually works, as I understand it, it's the distance from the homepage via clicks, not the number of characters in the URL that matters. I suggest you refer to this and only this for SEO and Wordpress: yoast.com/articles/wordpress-seo –  Tom J Nowell Apr 23 '12 at 13:54
    
Also bear in mind what you're asking for has many, many pitfalls that could utterly destroy your site, e.g. a taxonomy term called wp-admin would make your dashboard innaccessible etc –  Tom J Nowell Apr 23 '12 at 13:55
show 1 more comment

Not the answer you're looking for? Browse other questions tagged or ask your own question.