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


and what I want it to be is


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?

1 Answer 1


Try this

    register_post_type( 'my_services', $args);
    register_taxonomy( 'my_service_cats', 'my_services', $args);
  • 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, 2012 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. Jul 28, 2012 at 12:02

Your Answer

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

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