我对 WordPress 插件 - WooCommerce 中的类别和子类别有疑问。我正在创建一个脚本来创建一个类别和子类别,问题是我不完全理解这一切在 WooCommerce DB 结构中是如何工作的。
这就是我能够做到的:
在“wp_terms”中:
term_id | name | slug | term group
20 | Parent category | parent | 0
21 | Children category | children | 0
在“wp_term_taxonomy”中:
term_taxonomy_id | term_id | taxonomy | description | parent | count
1 | 20 | product_cat | | 0 | 0
2 | 21 | product_cat | | 20 | 0
这行得通,但是为什么这不行:
在“wp_term_taxonomy”中:
term_taxonomy_id | term_id | taxonomy | description | parent | count
1 | 20 | product_cat | | 21 | 0
2 | 21 | product_cat | | 0 | 0