Create Subcategories for Directory Listings


I have a huge list of categories because I have lots of subcategories. Is there a way to create main categories ans subcategories?

Example of Main Category: Surgery

Example of Subcategory: Plastic Surgery

I need to show only the main categories in that drop-down list. I'm using Advanced Post Search plugin.

Hope you guys can help me as always.



  • Predrag Dubajic
    • Support

    Hey @jose,

    Hope you’re doing well today :slight_smile:

    According to their forums adding something like this in your theme functions.php file should do the trick:

    add_filter('acf/fields/taxonomy/wp_list_categories', 'my_taxonomy_args', 10, 2);

    function my_taxonomy_args( $args, $field )
    // do stuff to $args
    $args['depth'] = 1;
    return $args;

    See more info here:

    Let me know if this worked for you.

    Best regards,


  • Adam Czajczyk
    • Support Gorilla

    Hey Jose,

    I hope you’re well today!

    Our Directory plugin supports subcategories out of the box. To create subcategory you just need to either select a parent category from the drop-down list during adding the category or just edit your existing categories (see screenshot).

    As for displaying the subcategories in a search drop-down list. I can confirm that the given code seems not to be working any more. However, I’ve got another code for you that I’ve tested on my test site and it works just fine.

    Please download the attached .zip file and unpack it. Copy the entire code from the patch-categories.php file and paste it to your functions.php theme.

    The replace the [acps] shortcode with [wpmu_acps] shortcode like this:

    [wpmu_acps id=”1816″]

    where 1816 is the ID of my search form (replace it with yours).

    Let me know if it helped!



Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.