Skip to content

Instantly share code, notes, and snippets.

@dartiss
Created November 15, 2017 16:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dartiss/7dbe50c71e11e1a9120384d6adf3abf3 to your computer and use it in GitHub Desktop.
Save dartiss/7dbe50c71e11e1a9120384d6adf3abf3 to your computer and use it in GitHub Desktop.
Add Your Own Default Avatar to WordPress
<?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' );
?>
@dartiss
Copy link
Author

dartiss commented Nov 15, 2017

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 your uploads folder.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment