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.

I've found this great plugin Custom Post Type Permalinks by a Japenese developer which is awesome at generating hierarchical permalink structures for Custom Post Types. Only I'm having an issue which I cannot get around and am looking for a solution.

I have a custom post type classes and a taxonomy classes_categories (ex: languages, technology, sciences...)

The links generated by WordPress for the 'classes_categories' look like this:

http://site.com/classes/class_categories/languages/

I would like them to be like this:

http://site.com/classes/languages/

Strangely, both of the URL's work but I would like WordPress to generate them without 'class_categories' in the URL.

I'm looking for a solution which would involve either plugin configuration, my taxonomy declaration parameters or perhaps a workaround with a hook or something (maybe parse the URL when they a being rewritten).

thank you

share|improve this question
add comment

2 Answers

up vote 0 down vote accepted

I managed to find a way to fix this by toying with my Custom Post Type and Taxonomy registrations.

In register_post_type properties:

'rewrite' => array( 'slug' => 'classes' ),

In register_taxonomy properties:

'rewrite' => array( 'slug' => 'classes', 'with_front'=> false ),

I now have a clean structure where http://site.com/classes/ points to the post type archive template, http://site.com/classes/languages/ points to the taxonomy archive template and http://site.com/classes/languages/french/ points to the post template

share|improve this answer
add comment

I am the author of Custom Post Permalinks.

The Permalink like

http://site.com/classes/languages/

is impossible.

Because, /languages/ is unable to determine term_name or post_name.

Sorry. But I want to achieve.

share|improve this answer
    
Hi Hiroshi, like I mentioned, I was able to achieve this with simple configuration. In the plugin options, I set the classes strcuture to /%class_categories%/%postname%/. Then in the registration parameters, I set the rewrite parameters as described above. DM me on Twitter @seb2point0 if you would like more info on how I did this. –  Sebastien Jul 10 '13 at 7:58
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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