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'键,特别将'+'字符替换为空格,以确保安全。