问题描述
我一直试图从索引中排除特定的“批发商类别”(b2b_only)。 Yoast 似乎忽略了波纹管代码。或者就我在元标题中看到的,产品仍然在索引和关注中。
add_filter( 'wpSEO_googlebot','yoast_SEO_robots_remove_single' );
add_filter( 'wpSEO_bingbot','yoast_SEO_robots_remove_single' );
add_filter( 'wpSEO_robots','yoast_SEO_robots_remove_single' );
function yoast_SEO_robots_remove_single( $robots ) {
if ( is_product() && has_term( 'b2b_only' ) ) { //check for b2b category
return 'noindex,nofollow'; //noindex nofollow this product
}
else {
return $robots; //else return robots
}
}
我不确定是 WP 还是 Yoast 否决了这一点。非常感谢任何帮助。
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)