# User avatar preference spontaneously changing to "Custom picture"

**URL:** <https://meta.discourse.org/t/user-avatar-preference-spontaneously-changing-to-custom-picture/56977>\
**Category:** WordPress\
**Created:** [6 Febbraio 2017, 2:34pm UTC](https://meta.discourse.org/t/user-avatar-preference-spontaneously-changing-to-custom-picture/56977 "2017-02-06T14:34:09Z")\
**Posts on this page:** 1\
**Showing post:** 6

<div class="post-metadata">

**Author:** ![pjv](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pjv/32/115994_2.png) [@pjv](https://meta.discourse.org/u/pjv)\
**Post date:** [8 Febbraio 2017, 11:12am UTC](https://meta.discourse.org/t/user-avatar-preference-spontaneously-changing-to-custom-picture/56977/6 "2017-02-08T11:12:34Z")

</div>

Yeah, I came to the same conclusion yesterday when I looked at the SSO payload in the plugin, so since we don’t use avatars at all on the WP site I’m managing, I just commented out the `avatar_url` line as a proof of concept and viola - no more blank avatars.

So I would have sent you a quick PR, but when I started to think about it, I didn’t know how to validate whether we’d be sending a valid `avatar_url` or not. The WP function `get_avatar_url` is supposed to return `false` if there isn’t one defined, so it would be easy enough to only send the avatar\_url `if ( false !== get_avatar_url(get_current_user_id()) )` and that would probably be an improvement, but I don’t know for sure if that would solve the problem entirely because you could be sending invalid (but non-false) URLs depending on how your WP environment is set up.

Maybe the right thing to do is both your setting in the wp-discourse plugin so WP admins can turn off any avatar syncing (like I would in the case of this particular integration) and to also implement the logic I wrote above so that we never send `avatar_url` when `get_avatar_url` returns false.

---

_[View the full topic](https://meta.discourse.org/t/user-avatar-preference-spontaneously-changing-to-custom-picture/56977)._
