How to Change Avatar Size in WordPress Comments

I wanted to increase avatar size (Gravatar) in my WordPress comments, but any amount of CSS tweaking for the avatar size would not work. I realized the avatar size was generated hard coded in html and there was no way to change that.

A quick view at your comments.php file would reveal that the comments are output by this code.

<ol class="commentlist">
<?php wp_list_comments(); ?>

Note that we had set the type argument to show comments only (not pingbacks / trackbacks) so our code looks like this right now

<ol class="commentlist">
<?php wp_list_comments(array('type' => 'comment')); ?>

So wp_list_comments is the target file which generates the hard coded avatar size of 32x32px. I wanted to increase the avatar size to 48x48px, so here is how I modified the code to look like this. Change the 48 to any size you like from 1-512.

<ol class="commentlist">
<?php wp_list_comments(array('avatar_size' => '48', 'type' => 'comment')); ?>

Now we are showing comments with avatar size of 48x48px. Post a comment and try for yourself. (Obviously you have a gravatar by now with the same email address or your avatar would not show on any site).

10 comments on “How to Change Avatar Size in WordPress Comments

  1. dvdrippingsoftware says:

    Im sure this is useful for wordpress novices like me …

  2. caroline wabara says:

    Thanks for the tip. I’m gonna try this.

  3. Julian says:

    if i remember correctly, you can change the size in General Option > Discussion

  4. Mi Kapa says:

    Thanks, that was what i was looking for!

  5. Praveen says:

    Customizing wordpress is interesting…. thanks for this tutorial :)

  6. Macaroni Schotel says:

    Thanks for the tips. I will use them to change my avatar

  7. Javi says:

    Thank you very, very much! I’m new to WordPress but this tutorial was super easy to understand and apply. I don’t know why the default avatar size has to be so small…

  8. Filip Klar says:

    Thank you for your post. I was looking for this option in the CSS style very long ;) And it’s so easy.

  9. Adewumi Adegboyega says:

    oh great info,thanks so much on this

Leave a Reply

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