有些时候我们需要在某个特定的分类目录下的文章链接添加nofollow的属性,比如放置软件下载文章的分类目录,这样做可以防止搜索引擎降权。对于这样的情况,可以用几行简单的代码来解决:
[code lang="php"]
function
nofollow_cat_posts($text)
{
global
$post;
if(
in_category(1)
)
{
// SET CATEGORY ID HERE
$text
=
stripslashes(wp_rel_nofollow($text));
}
return
$text;
}
add_filter('the_content'...