这是一个旧线程,但只是为了防止其他人需要它:从版本4.2开始,您可以使用pre_get_avatar
过滤以绕过拉取实际化身并仅发送回空字符串。
add_filter( \'pre_get_avatar\', \'rkv_remove_avatar_from_list\', 10, 3 );
/**
* Remove the avatar from just the user list.
*
* @param string $avatar HTML for the user\'s avatar. Default null.
* @param mixed $id_or_email The Gravatar to retrieve. Accepts a user_id, gravatar md5 hash,
* user email, WP_User object, WP_Post object, or WP_Comment object.
* @param array $args Arguments passed to get_avatar_url(), after processing.
*
* @return string An empty string.
*/
function rkv_remove_avatar_from_list( $avatar, $id_or_email, $args ) {
// Do our normal thing on non-admin or our screen function is missing.
if ( ! is_admin() || ! function_exists( \'get_current_screen\' ) ) {
return $avatar;
}
// Get my current screen.
$screen = get_current_screen();
// Bail without the object.
if ( empty( $screen ) || ! is_object( $screen ) || empty( $screen->base ) || \'users\' !== $screen->base ) {
return $avatar;
}
// Return an empty string.
return \'\';
}