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 have a blog and I want to make a modification to my custom post type to include the taxonomy term in the permalink. For example I have a custom post type named "my_services" and I have a custom post type to called "my_service_cats".

register_post_type( 'my_services', $args);
register_taxonomy( 'my_service_cats', 'my_services', $args);

In the custom post type I currently have the following items:

Hotel 1 / Hotel 2 / Hotel 3

The custom taxonomy contains the following terms:

Hotels / Rooms / Houses

Currently the url is

www.domain.com/services/hotel-1

and what I want it to be is

www.domain.com/hotels/hotel-1

I have been messing with the custom post type permalinks but the only thing I have managed to do is to create more problems with the posts categories that I already have.

Can you please help on how should I go about creating this structure?

share|improve this question
add comment

1 Answer 1

Try this

   $args['rewrite']=array('slug'=>'/%my_service_cats%/');
    register_post_type( 'my_services', $args);
    register_taxonomy( 'my_service_cats', 'my_services', $args);
share|improve this answer
    
Hello Rajeev, thank you for your post. Can you please give some more information on how should I go about implementing this because I just added it above the registration of the post type and seems that when I have www.domain.com/hotels/hotel-1 it redirects to www.domain.com/services/hotel-1 I am must be missing something there! –  nickast Jul 27 '12 at 12:04
    
@nickast it should be included in registering post type not above registering post type.. this has now created duplication of rewrite rule probably in your case, so now remove extra code, and include rewrite parameter as i specified in restering post type args. –  Rajeev Vyas Jul 28 '12 at 12:02
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.