WordPress自动给文章添加nofollow属性的实现方法


当前第2页 返回上一页

为指定分类的所有链接添加nofollow属性,那你可以将下面的代码添加到主题的 functions.php 文件即可:

代码如下:
function nofollow_cat_posts($text) {
global $post;
if( in_category(1) ) { // 修改这里的分类ID
$text = stripslashes(wp_rel_nofollow($text));
}
return $text;
}
add_filter('the_content', 'nofollow_cat_posts');

希望本文所述对大家的WordPress建站有所帮助。


标签:WordPress

返回前面的内容

相关阅读 >>

wordpress中is_singular()函数简介

wordpress后台添加子菜单的常用几种情况及对应方法

且谈wordpress性能优化分享

wordpress一键切换为其他用户身份登录功能方法

wordpress中删除垃圾评论的方法

详解wordpress中提醒安装插件以及隐藏插件的功能实现

wordpress静态化首页及去除url中的index.html

wordpress伪静态和中文标签支持配置方法

wordpress在iis服务器上的伪静态设置方法(解决中文url无法访问问题)

再docker中架设完整的wordpress站点全攻略

更多相关阅读请进入《wordpress》频道 >>



打赏

取消

感谢您的支持,我会继续努力的!

扫码支持
扫码打赏,您说多少就多少

打开支付宝扫一扫,即可进行扫码打赏哦

分享从这里开始,精彩与您同在

评论

管理员已关闭评论功能...