WordPress - 在子类别slug上显示自定义分类父类别

I'm using GeoCraft Theme by InkThemes as a Business Directory for a new website. As other themes like this, it was made to use listings only for one city, but I want to expand it to show listings for different cities.

To do that, I'll use on the Theme's custom taxonomy for cateogires (listcat), Parent Categories for the cities, and Child Categories for the business category itself.

So, I need something like this:

  • New York (Parent) - URL: mywebsite.com/listcat/new-york/
  • New York >> Restaurants - URL: mywebsite.com/listcat/new-york/restaurants/
  • Los Angeles >> Restaurants - URL: mywebsite.com/listcat/los-angeles/restaurants/
  • Los Angeles >> Bars - URL: mywebsite.com/listcat/los-angeles/bars/
  • Chicago >> Restaurants - URL: mywebsite.com/listcat/chicago/restaurants/

...and so on.

Instead, the child categories don't show the parent categories (new-york, los-angeles and other cities names).

Does anyone know how I can start achieving this? I searched for same questions but didn't find. I know how to use WordPress and use it for years but can accomplish this task. Edit:

I found the code used to register the category taxonomy for the directory listings:

// Register custom taxonomy for category
register_taxonomy(CUSTOM_CAT_TYPE, array(POST_TYPE), array("hierarchical" => true,
    "label" => CUSTOM_MENU_CAT_LABEL,
    'labels' => array('name' => CUSTOM_MENU_CAT_TITLE,
        'singular_name' => CUSTOM_MENU_SIGULAR_CAT,
        'search_items' => CUSTOM_MENU_CAT_SEARCH,
        'popular_items' => CUSTOM_MENU_CAT_SEARCH,
        'all_items' => CUSTOM_MENU_CAT_ALL,
        'parent_item' => CUSTOM_MENU_CAT_PARENT,
        'parent_item_colon' => CUSTOM_MENU_CAT_PARENT_COL,
        'edit_item' => CUSTOM_MENU_CAT_EDIT,
        'update_item' => CUSTOM_MENU_CAT_UPDATE,
        'add_new_item' => CUSTOM_MENU_CAT_ADDNEW,
        'new_item_name' => CUSTOM_MENU_CAT_NEW_NAME,),
    'public' => true,
    'show_ui' => true,
    "rewrite" => true)
);

Probably I should change something with rewrite, anyone already did this?

Thanks that worked!

Just add 'hierarchical' => true in the rewrite=>array() of the taxonomy as follows:

register_taxonomy( 'BLABLABLABIG-TAXONOMY', 'talalalala', array( 'hierarchical' => true,. . . . . . . . . . 'rewrite' => array( 'slug' => 'categories','hierarchical' => true ))

Then Go back in the Permalink settings and save them to flush the rewrite rules and voila!