Is there any way to change the aspect ratio of the WordPress Avatars? Or is this hardcoded?

3 Answers 3


Possible sollutions:

  • Use Css with something like overflow: hidden; and "cut out" what you need.
  • Use the filter apply_filters('get_avatar', $avatar, $id_or_email, $size, $default, $alt); and override the output of $avatar completely.
  • The function get_avatar() is pluggable. That means if you hook a plugin function early enough that already defines get_avatar() then this function will be used instead of the core function. See Core (link).

The aspect ratio is dictated by the Gravatar service and it's not customizable.

  • 1
    true but I think you can adjust the size via url if I'm not mistaken. Gravatar sends the suse in a url. I'm not 100% percent on this though May 18, 2011 at 5:27
  • I am talking about avatar size, not Gravatar size. I can disable gravatar and use also other sources and plugins to change the image source, but they all got the aspect ratio 1:1 May 18, 2011 at 8:03

It's a bit of a hack, but you can hard-code a new crop ratio by changing line 566 of wp-content/plugins/buddypress/bp-core/js/avatar.js from...

aspectRatio: self.options.aspectRatio,


aspectRatio: 1.72817,

... replacing 1.72817 with the aspect ratio of your choice of course.

Note you will also have to edit the same bit in avatar.min.js for it to work.

As it is a hack, you will have to be careful when updating Buddypress and you may have to keep re-applying the change. So if you can do it without hacking the core files then do that!

  • Never ever change code in any file in core or in plugins or themes which you did not author Aug 7, 2015 at 11:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.