admin管理员组文章数量:1316828
Is there a way to limit the standard post categories to only allow one level of subcategories?
For example, allow the following:
Fruit
> Apple
Veg
> Lettuce
But from here, do not allow "Apple" or "Lettuce" to be a parent.
Is this possible and how can I do it?
Edit: The categories will be the primary method of navigation and I want to stop clients from adding endless levels of sub-categories and overcomplicating the navigation. I know I could just tell them, but I think we all know what clients are like. 1 level of sub-category is useful in this case, 10 is a mess.
Is there a way to limit the standard post categories to only allow one level of subcategories?
For example, allow the following:
Fruit
> Apple
Veg
> Lettuce
But from here, do not allow "Apple" or "Lettuce" to be a parent.
Is this possible and how can I do it?
Edit: The categories will be the primary method of navigation and I want to stop clients from adding endless levels of sub-categories and overcomplicating the navigation. I know I could just tell them, but I think we all know what clients are like. 1 level of sub-category is useful in this case, 10 is a mess.
Share Improve this question edited Nov 13, 2020 at 16:39 Mr DC asked Nov 13, 2020 at 16:12 Mr DCMr DC 133 bronze badges 5- Why? What is your aim - perhaps explain how you tried to achieve this also, ir order to get some relevant responses. – Q Studio Commented Nov 13, 2020 at 16:14
- I have edited the question to clarify my reasons. – Mr DC Commented Nov 13, 2020 at 16:39
- Noting that nothing prevents this in the database, so multiple UI based solutions will be needed, e.g. preventing it in the block editor UI, preventing it in the term management page when added, preventing it in the term edit screen, etc. Doing it via hooks might work but would lead to broken UIs. Suffice to say it is going to be a significant amount of work to do this, and require someone with advanced PHP CSS and React skills to accomplish thoroughly – Tom J Nowell ♦ Commented Nov 13, 2020 at 17:23
- Of course you could prevent your navigation from displaying a 3rd level and tell your client it isn't currently supported, and that making 3rd level items visible would require billable design work – Tom J Nowell ♦ Commented Nov 13, 2020 at 17:26
- Thanks @TomJNowell - this is pretty much what I'm looking for. I was hoping there was a way to restrict it without extensive modification - Clearly there is not. – Mr DC Commented Nov 16, 2020 at 9:57
1 Answer
Reset to default 0I would suggest you hand-build the navigation menu using the selected taxonomy terms, not using a script to automatically add them, which is where you would have problems with new terms being added.
本文标签: taxonomyLimit categories to hierarchal depth of 2
版权声明:本文标题:taxonomy - Limit categories to hierarchal depth of 2 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741997154a2410275.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论