how can i add rel="nofollow" to link that have time tag, inside the comment-metadata div?
<div class="comment-metadata">
<a href="http://localhost/wordpress/hello-world/#comment-2">
<time datetime="2013-12-22T10:43:03+00:00">...</time>
</a>
</div>
function add_nofollow_to_comment_metadata( $link ) {
return str_replace( '")\'>', '")\' rel=\'nofollow\'>', $link );
}
add_filter( 'comment_comment_metadata', 'add_nofollow_to_comment_metadata' );
i use <?php wp_list_comments(); ?>
<?php wp_list_comments(); ?>
without any customise.
There is no way to modify this behavior via hooks or filters. But you can implement this by:
Walker_Comment
class and implementing your custom functionality. The first option is obviously simpler.
您不需要添加代码WordPress会自动nofollow评论链接
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.