0

I have a custom hierarchical taxonomy called "places" set up with categories like so: Services > Financial Services > Financial Advisors.

The permalink for this category listing page is currently mysite.com/places/services/financial-services/financial-advisors.

Does anyone know how I can remove the parents from my permalinks so it would simply become mysite.com/places/financial-advisors/ ?

I've searched quite a lot and cannot find an answer. There's a plugin out there called "no category parents" that achieves this for regular blog posts, but it doesn't work for custom taxonomies.

Any help would be much appreciated!

2 Answers 2

1

Simply set to false 'hierarchical'=>true from rewrite parameter in your register_taxonomy. It should looks like this:

register_taxonomy('places', 'post', array(
    // Hierarchical taxonomy
    'hierarchical' => true,
    'labels' => array(
        //here your labels
    ),
    // Control the slugs used for this taxonomy
    'rewrite' => array(
        'slug' => 'places', 
        'with_front' => false, // Don't display the category base before "/places/"
        'hierarchical' => false // This will avoid terms concatenation!
    )
));
0

Check this plugin Taxonomic SEO Permalink.

Also check this stackexchange question. Remove taxonomy slug from a custom hierarchical taxonomy permalink

Hope this will solve your problem. Cheers!!!

2
  • Thanks, but I've tried Taxonomic SEO Permalink and it doesn't seem to do what I want. I also looked through that other question posted but I think they are talking about simply removing the CPT name from the URL? At any rate, I tried all of the options in the thread and was unable to remove any parents from the permalink.
    – JWP
    Commented May 13, 2012 at 12:52
  • Well, this answer is off topic - it won't solve this problem, I guess. JWP doesn't want to remove taxonomy slug from url and I wouldn't suggest to use this plugin (it wasn't updated since 2011). Commented Jun 22, 2013 at 7:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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