add_filter( 'get_avatar' , 'my_custom_avatar' , 1 , 5 ); function my_custom_avatar( $avatar, $id_or_email, $size, $default, $alt) { if ( ! empty( $id_or_email->user_id ) ) { $avatar = "http://static.cnblogs.com/images/logo_small.gif"; }else{ $avatar = "http://static.cnblogs.com/images/logo_small.gif"; } $avatar = "<img alt='{$alt}' src='{$avatar}' class='avatar avatar-{$size} photo' height='{$size}' width='{$size}' />"; return $avatar; }