# Map custom User Fields

**URL:** https://meta.discourse.org/t/map-custom-user-fields/156164
**Category:** WordPress
**Created:** [June 28, 2020, 11:44am UTC](https://meta.discourse.org/t/map-custom-user-fields/156164 "2020-06-28T11:44:03Z")
**Posts on this page:** 1
**Showing post:** 3

<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: [June 29, 2020, 6:33pm UTC](https://meta.discourse.org/t/map-custom-user-fields/156164/3 "2020-06-29T18:33:41Z")

</div>

> [@tiagofreitas87](#):
>
> I think I found how to it, but needs to be changed in [wp discourse](https://github.com/discourse/wp-discourse) plugin after every update:

I wouldn’t make any direct changes to the plugin’s code unless you are certain about what you are doing. The [WP Discourse](https://github.com/discourse/wp-discourse) plugin is built to allow it to be extended by a plugin or a theme by using [action hooks](https://developer.wordpress.org/plugins/hooks/actions/). This allows you to customize the plugin without making changes that will be overridden when you update the plugin.

To add data to the SSO payload that is sent to Discourse, use the `wpdc_sso_params' filter. Functions that hook into that filter are passed two parameters: `$params`(an array of SSO parameters that are passed to Discourse) and `$user` (the WordPress user object.)

There is an example of how to use the filter in this post:

> [@Bring over permission level from WordPress MemberPress](https://meta.discourse.org/t/bring-over-permission-level-from-wordpress-memberpress/78074/2):
>
> There are a couple of ways to do it. The easiest way is to add the Discourse group names to the SSO payload. You can do this by hooking into the wpdc\_sso\_params filter. Setting it up this way will add and remove users from groups when they login to Discourse. You’ll need to figure out the condition to check the user against to know which groups to add or remove them from. Memberpress fires an action when a membership level is added or removed. You could hook into that action and add some user me…

Let me know if you have any trouble using the filter to add your custom userfield data.

---

_[View the full topic](https://meta.discourse.org/t/map-custom-user-fields/156164)._
