There are two ways to change the Gravatar image size in WordPress:
Using the WordPress Customizer
- Go to Appearance > Customize.
- In the left sidebar, select Comment.
- In the right sidebar, under Gravatars, you will see a field for Image Size. Enter the desired size in pixels.
- Click Publish to save your changes.
- Connect to your WordPress site using FTP.
- Navigate to the following directory:
- Open the
comments.phpfile in a text editor.
- Find the following line of code:
$avatar_size = 96;
Use code with caution.
- Change the value of
96to the desired size in pixels.
- Save the
comments.phpfile and upload it back to your WordPress site.
The new Gravatar image size will now be used for all comments on your site.
Note: The maximum Gravatar image size is 512px by 512px. If you set the image size to a larger value, the Gravatar may appear blurry.
- You can also change the Gravatar image size for specific user roles. To do this, you will need to edit the
user-role.phpfile in your theme.
- If you are using a child theme, you can create a custom
comments.phpfile and override the default settings.
- You can also use a WordPress plugin to change the Gravatar image size. There are many plugins available, so you can choose one that best suits your needs.
Read also: How to embed videos in WordPress posts/pages
Do you want to learn web design with WordPress with Experts? Register today