HUSKY - Product Filter for WooCommerce

woof_override_seo_request_uri

v.2.2.6/1.2.6 版本起

用于扩展「SEO URL 请求」——传递当前 URL。如有必要,需适配不同的服务器。

参数

$uri (string) — the current request URI

源文件

ext/url_request/classes/url_parser.php

代码示例


add_filter('woof_override_seo_request_uri', function($uri) {
    // Clean up the SEO URL for specific pages
    if (is_shop()) {
        $uri = '/shop' . $uri;
    }
    return $uri;
});

使用说明

  • 将此代码添加到主题的 functions.php 文件或自定义插件中。
  • 该钩子在筛选过程中被应用——更改立即生效。
  • 始终从回调函数返回期望的值类型。