WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am working in a WP multisite which runs on a classipress theme and there is a custom post type "ad_listing" and custom taxonomy type "ad_cat". Now the url is like this


I need to rewrite this URL so it looks like


and categories are nested so it can be nth level.

Please help me how to do that with wp rewrite rules.

Thanks in advance.Any help will be greatly appreciated.

share|improve this question
up vote 0 down vote accepted

When you are adding a custom taxonomy you are able to declare a rewrite slug -

$labels = array(
    'name' => _x('Name', 'taxonomy general name'),
    'singular_name' => _x('Singular Name', 'taxonomy singular name'),
    'search_items' =>  __('Search Items'),
    'all_items' => __('All Names'),
    'parent_item' => __('Parent Item'),
    'parent_item_colon' => __( 'Parent Ites:'),
    'edit_item' => __('Edit Item'), 
    'update_item' => __('Update Item'),
    'add_new_item' => __('Add New Item'),
    'new_item_name' => __('New Item Name'),

    array('post-type1', 'post-type2'),
        'hierarchical' => true,
        'labels' => $labels,
        'show_ui' => true,
        'query_var' => true,
        'rewrite' => array('slug' =>'new-york-city')
share|improve this answer
Thank you so much David.That resolved my problem.You saved me. – Sourav Sarkar Feb 23 '12 at 11:14
You are welcome. – David Gard Feb 23 '12 at 11:16

Your Answer


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.