我想更改此屏幕截图中显示的评论者链接:
在里面my test plugin at GitHub 我首先尝试了以下代码:
define(\'PROFILE\', \'<a href="/user/%s" rel="external nofollow" class="url">%s</a>\');
function get_comment_author_link($cid) {
$uid = get_comment_author($cid);
return sprintf(PROFILE, $uid->ID, $uid->name);
}
add_action(\'get_comment_author_link\', \'get_comment_author_link\');
但是通过研究文件wp-includes/comment-template.php
我意识到get_comment_author_link
不是注释ID,而是包含<a href="...">...</a>
因此,我无法将此挂钩用于我的目的(因为在挂钩中找不到用户ID)。请建议我一个合适的钩或方式来改变评论链接。