0

I have a portfolio and we have added custom secondary sorting based on sub categories.

Client clicks categories and sub categories in backend.

On front end... user picks main category... a lit of subs shows up and they can further refine projects by them

Everything works great EXCEPT on a few sub category sorts for some reason. Also, we can't add a new sub category now and get it to work. Any new subcategory added and applied to a project returns no results.

Sub Categories not working are:

Forensic > Medical examiner/coroner

Forensic > New construction

Academic > New construction

Clinical > New construction

Corporate > New construction

Government > New construction Research > New construction

I checked and the slugs are all different names for the "new construction" instances...

Any ideas what would cause this? There are projects with these combos in the portfolio.

1 Answer 1

0
You can use below code: 

$args = array(
    'type'                     => 'product',
    'child_of'                 => 0,
    'parent'                   => '',
    'orderby'                  => 'term_group',
    'hide_empty'               => false,
    'hierarchical'             => 1,
    'exclude'                  => '',
    'include'                  => '',
    'number'                   => '',
    'taxonomy'                 => 'product_cat',
    'pad_counts'               => false
);

$cats = get_categories( $args );
2
  • Please edit your answer, and add an explanation: why could that solve the problem?
    – fuxia
    Jul 9, 2018 at 8:49
  • @Trilok . Thanks but the categories work... And a majority of the subs work (there are close to 20 subs) It's just these instances above... would there be something that would prevent just those from working?
    – Scott
    Jul 9, 2018 at 12:57

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.