# How to make a custom field unique for users

URL: https://wpusermanager.com/article/287-how-to-make-a-custom-field-unique-for-users/
Last updated: 2021-05-30

If you have a custom field that you want users to fill out at registration but the value has to be unique, eg. it hasn't be used by another user, then read on.

First set up a custom field via Users > Custom Fields.

Then add this code to a wpum.php file in your /wp-content/mu-plugins/ directory (you might need to create the mu-plugins directory).

Change the field key to match yours, which you can see when editing the custom field. Also change the error message to make it more related to your field.

https://gist.github.com/wp-user-manager/85437727785153605bd2cd6ddd87aef8
