Skip to content

Instantly share code, notes, and snippets.

@temsool
Created October 9, 2018 09:45
Show Gist options
  • Save temsool/2b526613fd04a5f8c627d78cf7afec68 to your computer and use it in GitHub Desktop.
Save temsool/2b526613fd04a5f8c627d78cf7afec68 to your computer and use it in GitHub Desktop.
elementor gravatar fix
<?php
add_filter('get_avatar_url', function( $url, $id_or_email, $args ) {
if (is_email($id_or_email)) {
$user = get_user_by('email', $id_or_email);
$user_id = $user->ID;
} else {
$user_id = $id_or_email;
}
if (has_wp_user_avatar($user_id)) {
return get_wp_user_avatar_src($user_id, 'writer-avatar');
}
return $url;
}, 10, 3);
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment