add_filter( \'get_avatar\' , \'alt_name_avatar\');
function alt_name_avatar( $avatar ) {
$alt = get_comment_author();
$avatar = str_replace(\'alt=\\\'\\\'\',\'alt=\\\'Avatar for \'.$alt.\'\\\' title=\\\'Avatar for \'.$alt.\'\\\'\',$avatar);
return $avatar;
}
此代码可以工作,但会引发错误。
PHP Notice: Trying to get property \'user_id\' of non-object in .../wp-includes/comment-template.php on line 28
PHP Notice: Trying to get property \'comment_ID\' of non-object in .../wp-includes/comment-template.php on line 48
如何修复。
P.S.我在所有页面上使用侧边栏中带有Gravatar的最新评论
对不起,我的英语不好。