Created
November 15, 2017 16:11
-
-
Save dartiss/7dbe50c71e11e1a9120384d6adf3abf3 to your computer and use it in GitHub Desktop.
Add Your Own Default Avatar to WordPress
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 | |
function new_avatar( $avatar_defaults ) { | |
$new_avatar = content_url() . '/uploads/[your image]'; | |
$avatar_defaults[ $new_avatar ] = 'No Avatar'; | |
return $avatar_defaults; | |
} | |
add_filter( 'avatar_defaults', 'new_avatar' ); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Is there a fun image you'd like to use as the default user image if they don't have a Gravatar? This is what you need - just add the code to your theme's
functions.php
, replace[your image]
with the name of the image in youruploads
folder.