·您现在的位置: 云翼网络 >> 文章中心 >> 网站建设 >> 网站建设问答 >> WordPress评论时间nofollow修改方法

WordPress评论时间nofollow修改方法

作者:佚名      网站建设问答编辑:admin      更新时间:2022-07-23

WordPress评论时间nofollow与评论链接nofollow、阅读全文more-link nofollow如出一辙,都是由于他们的链接后面加了 #* 这样的锚文本。

修改方法

在 /wp-includes/comment-template.php 文件中找到

<div class="comment-meta commentmetadata"><a href="<?php echo htmlspecialchars( get_comment_link( $comment->comment_ID ) ) ?>">
    <?php
        /* translators: 1: date, 2: time */
        printf( __('%1$s at %2$s'), get_comment_date(),  get_comment_time()) ?></a><?php
        edit_comment_link(__('(Edit)'),'&nbsp;&nbsp;','' );
    ?>
</div>

修改为

<div class="comment-meta commentmetadata"><a rel="nofollow" href="<?php echo htmlspecialchars( get_comment_link( $comment->comment_ID ) ) ?>">
    <?php
        /* translators: 1: date, 2: time */
        printf( __('%1$s at %2$s'), get_comment_date(),  get_comment_time()) ?></a><?php
        edit_comment_link(__('(Edit)'),'&nbsp;&nbsp;','' );
    ?>
</div>

即可。

本文来自:DeXu.Xie‘s Blog,原文地址:http://xiedexu.cn/wordpress-comment-time-link-nofollow.htm