woof_text_filter_labels
过滤在 Husky 文本搜索中分配给产品的标签 slug 数组,允许自定义每个搜索结果显示哪些标签。
参数
$labels (array) — 与当前产品文章 ID 匹配的标签字符串 slug 数组
源文件
ext/by_text/index.php:1098
代码示例
add_filter('woof_text_filter_labels', function($labels) {
// Remove a label from display
return array_values(array_diff($labels, ['hidden-label']));
});
使用说明
- 从 Husky 搜索结果中每个产品的私有 get_labels() 方法调用。
- 标签在插件选项的 'for_labels' 设置下定义。
- 标签通常用作搜索结果项上的徽章或标签。