I had a question about sorting a taxonomy. We have a two-level taxonomy named Services. I'd like to sort them by the number of items in the second level. (Not the number of posts, but the number of subcategories.) Please see attached for what we're trying to accomplish.
As you can see, the first column has 12 subcategories, the second column has 6 subcategories, and the third column has 4 subcategories. Is this possible to do? If so, how?
Hello. Thank you for contacting the Toolset support.
There is no such native way to do it but the possible way could be you need to add a custom term field and store the number of subcategories value for the parent term and then try to sort it accordingly. You can save the number of child terms to custom term field when you save the parent term.
If you do not know how to do it - please send me problem URL and admin access details.
*** Please make a FULL BACKUP of your database and website.***
I would also eventually need to request temporary access (WP-Admin and FTP) to your site. Preferably to a test site where the problem has been replicated if possible in order to be of better help and check if some configurations might need to be changed.
I have set the next reply to private which means only you and I have access to it.
The above code will be used to set the number of total child terms to term field "child-term-count" we created using Toolset.
Now, can you please tell me where and on what page you want to display the terms based on the total child count - can you please share link of that page?
Thanks for furnishing the code and explaining how it works. It's all pretty clear to me. I think the last step requires me to sort the view by the child-term-count, and I can do that.
No need for you to add it to the page, I can take it from here.