How To Add Text Box In User Profile
Posted By Renu Yadav | 30-Apr-2018
In WordPress have many build in functionality which makes our work easy. We don't need that much functionality to add from our side. Wordpress already has predefined functions according to our need.
Add below code in your function.php. After adding the code, login to admin panel and check the user profile. You can see now there is employee id text box. If you add the employee id in the text box then save the employee id. After that, you can see you can edit the employee id in the admin panel. We don't need to add the code for access the employee id of the user and don't need to write the code for saving the employee id in the database because WordPress have a predefined function to save the value of employee id and access the value of employee id in the text box.
Employee id value will store in wp_usermeta table . Employee id text will store in meta_key column and value of employee id will store in meta_value column . These values are stored in a table according to the user id. In wp_usermeta table, there is a user_id column, where WordPress store the user id. You have user id column so that if you want to access employee id according to the user id.You can access the data. If you want to access the whole employee id of all user.You have the wp_usermeta table. You can easily access all employee id of all user.
Like above field, we can also make the company name, telephone number, city, pin code, father name, Adhar card, PAN card number Address, office address etc field in the user profile. You can add many fields in user profile page as you want. The text box is very useful for the user profile. He can add the details and also update the details.