Created
November 2, 2018 15:46
-
-
Save mehul0810/61b783f57294dc8fe1322bcacf77583d to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* This function will add new custom avatar to WordPress. | |
* | |
* @param array $avatars List of avatars in WordPress. | |
* | |
* @author Mehul Gohil | |
* @link https://www.mehulgohil.in/set-default-avatar/ | |
* | |
* @return array | |
* | |
*/ | |
function mg_add_new_custom_avatar( $avatars ) { | |
$new_avatar = get_template_directory_uri() . '/assets/images/custom-gravatar.svg'; | |
$avatars[ $new_avatar ] = __( 'My Custom Gravatar', 'my-text-domain' ); | |
return $avatars; | |
} | |
add_filter( 'avatar_defaults', 'mg_add_new_custom_avatar', 10, 1 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment