如何删除产品类别别名但显示所有别名类别术语和子类别 woocommerce

问题描述 投票:0回答:1

所以我关注了这篇文章,效果很好。但不包括子类别。

第二个子类别中的第一个工作正常,但如果子类别超过 2 个,则返回 404。看看这个:

  • 我有这个面包屑,每个都可以点击(因为它是一个子类别)
  • 就像我说的,第二个子类别中的第一个可以单击,但其余的,它返回404。第二个子类别中的第一个是test1和test2-productcat(home不算)。

到目前为止我已经尝试过:

  • var_dump 第一个面包屑(test1),它显示如下:
array(2) { ["page"]=> string(0) "" ["name"]=> string(5) "test1" }
  • var_dump 第二个面包屑 (test2-productcat) :
array(1) { ["attachment"]=> string(16) "test2-productcat" }
  • 之后就返回404,就像这样
array(1) { ["error"]=> string(3) "404" }

为什么会有这样的表现?我的意思是第一个是返回页面,第二个是返回附件?有可能像我想要实现的那样吗?

谢谢你。

编辑: 如果你们想知道我如何管理类别,我会这样设置类别:

  • test1 test2-productcat 的父类别
  • test2-productcat 是 test1 的子项
  • test3-product-cat 是 test2-productcat 的子项
  • jepitan-pin-rambut 是 test3-product-cat 的子级
  • 等等

有人吗?我还是想不明白...

php wordpress woocommerce hook-woocommerce
1个回答
0
投票

好的,所以我找到了解决方案。只需使用 woocommerce 插件永久链接管理器即可。瞧,效果非常好。

© www.soinside.com 2019 - 2024. All rights reserved.