PressTigers

Changing Default User Avatar in WordPress

WordPress has a default avatar for users who register themselves on a particular WP site. Instead of using a default avatar, users can upload their own profile avatar. In this article, you will learn how to change the default user avatar.

Seven default avatars are available in WordPress; a user/admin can select any of them. From WordPress Dashboard admin menu, just navigate to Settings->Discussion.

changing-default-user-avatar-in-wordpress-1

In the screenshot above, default avatars are listed as follows:

  1. Mystery Person
  2. Blank
  3. Gravatar Logo
  4. Identicon (Generated)
  5. Wavatar (Generated)
  6. MonsterID (Generated)
  7. Retro (Generated)

Mystery Person” is selected by default. Additionally, you can see in the screenshot “PressTigers Avatar“, which is a custom avatar added by using the following code:

With this code, “avatar_defaultsfilter will add a new avatar option in the list. The filter function has one array “$avatar_defaults“. This array contains the list of default avatars and you can add or remove any of them. To add a new default avatar in the list, following two inputs are required:

  1. Avatar Image URL
  2. Name of the Avatar

For the above mentioned case, we have the following URL and name:

Now, create a variable “$myavatar” and assign the image URL to it. After that, add “$myavatar” to the “$avatar_defaults” array. At the end, this array will be returned and the new avatar will be added in the default avatar list.

User Comments

Leave a Reply

Your email address will not be published. Required fields are marked *

    Get in Touch