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 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

http://www.example.com/ad-category/transport/

I need to rewrite this URL so it looks like

http://www.example.com/new-york-city/transport/

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
add comment

1 Answer 1

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'),
);

register_taxonomy(
    'ad_category',
    array('post-type1', 'post-type2'),
    array(
        '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
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.