Read More
Read More
Menu Close

    WordPress Custom Fields User Profile Page

    WordPress Add Custom Fields User Edit Profile Page – In this post we see how we can add custom fields to user profile edit page in WordPress at admin end. When admin wants to add some extra information for the users in his/her site, then custom fields can play important role.

    As we know, WordPress provides hooks for almost every other feature/functionality so that we can update or manipulate according to our need. So for this also we’ll use some hooks to fulfill our post purpose.

    Let’s start with the code –


    In above code, we add action to hook ‘edit_user_profile’ and create one input field in callback function. This function will display field when you are editing other user profile. If you want to show created fields for all profiles then use ‘show_user_profile’ hook and add action for same callback function.


    After executing above code, custom field will display on user profile edit page as below –

    WordPress Custom Fields User Profile Page

    Now, to save the data for created custom fields we’ll use ‘edit_user_profile_update’ hook.


    The hook used above ‘edit_user_profile_update’ only triggers when user editing other user profile in the same way we mentioned above for displaying the fields. To save data for all user profiles, then you also need to use ‘personal_options_update’ hook.

    Start your headless eCommerce
    now.
    Read More

    Reference –

    1 – https://codex.wordpress.org/Plugin_API/Action_Reference/edit_user_profile

    2 – https://codex.wordpress.org/Plugin_API/Action_Reference/edit_user_profile_update

    Support

    Still have any issue feel free to add a ticket and let us know your views to make the code better https://webkul.uvdesk.com/en/customer/create-ticket/

    Thanks for Your Time! Have a Good Day!

    . . .
    Discuss on Helpdesk

    Leave a Comment

    Your email address will not be published. Required fields are marked*


    Be the first to comment.

    Back to Top

    Table of Content