WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I added a custom field to my wordpress user profile page that asks a user what their favorite browser is. I have the field on the profile.php page, but how can I get this field into my sql database?

What sql script do I need that will insert the user's answer into the table by their corresponding user meta number?


share|improve this question

To show extra fields in profile, use this hook:

function myplugin_show_profile_extra_fields( $user ) {
    // echo your extra fields here
add_action( 'show_user_profile', 'myplugin_show_profile_extra_fields' );
add_action( 'edit_user_profile', 'myplugin_show_profile_extra_fields' );

And to save extra fields use following hook:

function myplugin_save_profile_extra_fields( $user_id ) {
    if ( !current_user_can( 'edit_user', $user_id ) ) {
        return false;

    update_usermeta( $user_id, 'extra_field', $_POST['my_extra_field'] );
add_action( 'personal_options_update', 'myplugin_save_profile_extra_fields' );
add_action( 'edit_user_profile_update', 'myplugin_save_profile_extra_fields' );
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.