Apps Ballance Cash_2 Chat Checkout Click Code Cog_Wheels Compose_email Conference Contacts Earth Edit_File_1_ Email Email_2 File Folder_2 Gift Group Group_2 Help ID ID_2 Key Keys Laptop_Store Like_1_ Link Lock Log_Out Map Marketing Mobile_UI Navigation POS Partnership Profile Safe_2 Search_User Secure_Files Settings Share Shield Shield_2 Shopping_Cart Support_Male Trash Type_pin User_female User_male logo copy

How to make a custom field unique for users

Iain Poulson avatar
Iain Poulson Last updated on May 30, 2021

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

WP User Manager logo

Get Started with the Best WordPress Membership Plugin Today

Connect, Manage and Build your Membership Site

Need more help?

If you still didn't find an answer you can always contact us

Submit a ticket