建站教程

建站教程

Products

当前位置:首页 > 建站教程 >

如何去除wordpress评论中的nofollow的方法

GG网络技术分享 2025-03-18 16:04 0


nofollow与external nofollow有区别吗?在没明确二者的区别前我们先来相识一下二者的意思,rel=’external nofollow’与rel=’nofollow’其功效就中文译文”不要读取” 及”外部链接不要读取”的意思!由此可见二者的作用是雷同的,只不过external nofollow是比nofollow更专业的写法,即明白指出链接为外部链接,蜘蛛可以略过。  当我们不想让批评中的链接带有nofollow大概external nofollow属性时,该怎么去掉呢?打开我们的wordpress,然后找到wp-include文件夹,打开comment-template.php页面,找到如下代码

function get_comment_author_link( $comment_ID = 0 ) {

        $comment = get_comment( $comment_ID );

        $url     = get_comment_author_url( $comment );

        $author  = get_comment_author( $comment );

        if ( empty( $url ) || 'http://' == $url )

                $return = $author;

        else

                $return = "<a href='$url' rel='external nofollow' class='url'>$author</a>";

 

去掉rel='external nofollow'或者把这行代码换做 target=’_blank’即可

标签: WordPress 教程

提交需求或反馈

Demand feedback