WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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

share|improve this question
up vote 1 down vote accepted

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).
share|improve this answer

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

share|improve this answer
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 – xLRDxREVENGEx May 18 '11 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 – thelamborghinistory May 18 '11 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!

share|improve this answer
Never ever change code in any file in core or in plugins or themes which you did not author – Pieter Goosen Aug 7 '15 at 11:22

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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