The unique code in this download folder enables you to change the user profile picture for their avatar if desired, otherwise, a Gravatar is shown using their email address if it’s connected to a valid Gravatar account.
This code is not theme specific and works in any WordPress themes functions file, preferably in your child themes functions file.
Note : This code enables you to use a custom avatar globally meaning all instances of your default avatar including comments, author box and archives etc will be changed when you add your custom avatar.
Shows the custom image added on the User Profile edit page replacing all instances of your default Gravatar.
There’s 2 steps :
- # Copy & paste the PHP code ( without the opening PHP tag ) to the end of your child themes functions file.
- # Install the ( ACF ) Advanced Custom Fields plugin ( free or premium version ). In your WordPress Dashboard, go to Custom Fields > Tools and import the acf-108181.json file which enables you to add custom avatars on the Edit User profile admin page for each user or author as seen in the demo video and first screenshot in this post.