HUSKY - Product Filter for WooCommerce

woof_text_urlencode

控制 URL 查询字符串中的筛选器值是否应进行 URL 编码,从而在搜索参数中启用特殊字符处理。

参数

$encode (int) — 整数标志(0 或 1)— 0 表示不编码,1 表示筛选器值将被 urlencode() 处理

源文件

index.php:2053

代码示例

add_filter('woof_text_urlencode', function($encode) {
    // Enable URL encoding for special characters
    return 1;
});

使用说明

  • 位于 get_request_data() 方法中,该方法清理和处理 $_GET 参数。
  • 启用后,筛选器值在去除斜杠后会通过 urlencode() 处理。
  • 出于安全考虑,'woof_text' 键中的 '+' 字符会专门替换为空格。