# Avatar nicht aktualisieren, wenn Standard

**URL:** https://meta.discourse.org/t/dont-update-avatar-if-default/118877
**Category:** WordPress
**Created:** [28. Mai 2019 um 14:22 UTC](https://meta.discourse.org/t/dont-update-avatar-if-default/118877 "2019-05-28T14:22:08Z")
**Posts on this page:** 1
**Showing post:** 4

<div class="post-metadata">

### Author: ![simon](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/simon/32/339122_2.png) [@simon](https://meta.discourse.org/u/simon)
#### Post date: [28. Mai 2019 um 18:08 UTC](https://meta.discourse.org/t/dont-update-avatar-if-default/118877/4 "2019-05-28T18:08:34Z")

</div>

> [@dylanb](#):
>
> Yep, I am using WP User Avatar which sets a default avatar.

That will be the problem. The [WP Discourse](https://github.com/discourse/wp-discourse) plugin has a `'wpdc_sso_avatar_url'` filter that can be used to filter the avatar URL that is passed to Discourse. The filter is passed two parameters: `$avatar_url`, and `$user_id`.

To avoid sending the default avatar to Discourse, you’d need to add some code to your theme’s `functions.php` file that hooks into the filter and returns an empty string for users who have the default avatar:

```php
add_filter( 'wpdc_sso_avatar_url', 'wpdc_custom_sso_avatar_url', 10, 2 );
function wpdc_custom_sso_avatar_url( $avatar_url, $user_id ) {
    if ( /* some condition that returns true for users with the default avatar */ ) {

        return '';
    }

    return $avatar_url;
}

```

---

_[View the full topic](https://meta.discourse.org/t/dont-update-avatar-if-default/118877)._
