从过滤器页面中删除 Yoast SEO 插件添加的 rel 规范

Removing rel canonical added by Yoast SEO plugin from filter pages

我确实使用过滤器插件来生成这样的获取参数 https://example.com/product-category/mobile-phone/?product_brand=sony

并且 yoast 插件删除了“?”之后的所有参数。通过 "rel canonical" 标签和 它是这样的:

<link rel="canonical" href="https://example.com/product-category/mobile-phone/" />

1-我需要一个函数来禁用来自“?”的规范参数.

yoast 已经介绍了很多“remove functions”但不是这样

使用此代码:

function yoast_seo_canonical_change_product_category( $canonical ) { 

    if ( is_product_category() ) {      
        $canonical = false;
    }

    return $canonical;
}

add_filter( 'wpseo_canonical', 'yoast_seo_canonical_change_product_category', 99, 1 );