Custom Author Avatars For Any User

This code enables you to use a custom image in replace of a Gravatar hosted image for any author in any WordPress theme. You can add the images for each author in your child themes images folder.

Update : You’ll also find a 2nd solution which enables each user to upload a custom image which replaces the default avatar connected to their email address.

Here’s the demo video which shows Author 1 using a Gravatar hosted image and all other authors using a custom avatar.

Installation Instructions

There’s 3 simple steps:

Step 1 : Paste the PHP code below to the end of your child themes functions file.

Step 2 : Swap out the author id in the code to match the user id for each author. You can get each author id simply by hovering over the delete link on the Users > All Users admin page like you see in the following screenshot:

Step 3 : Add a image for each author to your child themes images folder like you see in the following screenshot:

Make sure the image file name for each author matches the file name in the PHP code.

This solution enables you to customize the authors image using code in your child theme rather than a plugin. The custom avatar image will display in the author box as well as the comments.

Here’s the code for logged in members:

Related Tutorials

Was This Tutorial Helpful?

Free

$0

Access only to all free tutorials per month.



Monthly

$75

Access to 10 premium tutorials per month.


Tutorial Request


Includes code guarantee and coding support.

Yearly

$500

Access to 15 premium tutorials per month.


Monthly Tutorial Request


Includes code guarantee and priority coding support.