# How to link wordpress avatars with discourse?

**URL:** <https://meta.discourse.org/t/how-to-link-wordpress-avatars-with-discourse/77255>\
**Category:** WordPress\
**Created:** [4 Enero, 2018 16:46 UTC](https://meta.discourse.org/t/how-to-link-wordpress-avatars-with-discourse/77255 "2018-01-04T16:46:22Z")\
**Posts on this page:** 1\
**Showing post:** 4

<div class="post-metadata">

**Author:** ![Ryan\_Collins1](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/ryan_collins1/32/76781_2.png) [@Ryan\_Collins1](https://meta.discourse.org/u/Ryan_Collins1)\
**Post date:** [4 Enero, 2018 17:43 UTC](https://meta.discourse.org/t/how-to-link-wordpress-avatars-with-discourse/77255/4 "2018-01-04T17:43:48Z")

</div>

@simon thanks again for the help.

Where should I put this filter in my discourse forum? Is there a specific place within my discourse admin settings where I should copy/paste this code?

```plaintext
add_filter( 'wpdc_sso_avatar_url', 'my_namespace_use_custom_avatar', 10, 2 );

function my_namespace_use_custom_avatar( $avatar_url, $user_id ) {
    if ( get_user_meta( $user_id, 'custom_field_1', true ) ) {
        $avatar_url = get_user_meta( $user_id, 'custom_field_1', true );
    }

    return $avatar_url;
}

```

---

_[View the full topic](https://meta.discourse.org/t/how-to-link-wordpress-avatars-with-discourse/77255)._
