How to change the default Gravatar on WordPress

Gravatar is WordPress’ default avatar system, used to associate WordPress users (and commenters) with unique email addresses. Once a Gravatar account is set up, the same avatar image is displayed next to comments made by the user on any WordPress site.

When you install WordPress, a series of default Gravatar images are made available, including a placeholder image displayed when a user has not selected their own avatar.

Default Gravatar

If you wish to change the default avatar, in the WordPress admin dashboard, head to Settings > Discussion.

Discussion settings

Scroll down to the Default Avatar section and you’ll see a few additional options are provided for selection. These designs use an algorithm to dynamically generate an avatar based on a comment author’s name or email address. Click the radio button next to a design and click Save Changes to switch the default avatar.

However, if you wish to select your own design, you should first create a square, 250 x 250 pixel image. Once created, navigate to Media > Add New and upload the image to your site.

Upload new media

Once the image has been uploaded, select it and then copy and paste its URL into a text editor like Notepad (Windows) or TextEdit (Mac OS).

Image URL

You’ll now need to edit your WordPress functions.php file, which you can do using cPanel File Manager. Log into the HostPapa Dashboard and select My cPanel. Now select Files > File Manager.


Navigate to your WordPress folder, then select wp-content > themes. Now enter your current theme folder. Select functions.php and click Edit in the command bar.

Copy and paste the following code into your functions.php file. Change the URL in $myavatar to the URL you pasted into the text editor earlier.

 * Change default gravatar.

add_filter( 'avatar_defaults', 'new_gravatar' );
function new_gravatar ($avatar_defaults) {
$myavatar = '';
$avatar_defaults[$myavatar] = "Default Gravatar";
return $avatar_defaults;

Save the file and reload the Settings > Discussion page in your WordPress admin dashboard. You’ll notice that your new default Gravatar image is now available for selection.

If you notice any problems or if you need any help, please open a new support ticket from your HostPapa Dashboard. More details on how to open a support ticket can be found here.

Related Articles