How can I create a field in the WordPress registration form?
-
Guys, how can I create a field in the WordPress registration form?
I would like to create a “Company name” field in this field that is of the text type, but it should work in the standard wordpress user search. You must enter this company information in the Site field that already exists and works in standard search, but when you fill in the field, it changes to http: //.com.——–
I tried to do it that way, however, it doesn’t work in standard search.function show_my_fields( $user ) { $fetched_field = get_user_meta( $user->ID, 'my_field', true ); ?> <tr class="form-field"> <th scope="row"><label for="my-field"><?php _e('Field Name') ?> </label></th> <td><input name="my_field" type="text" id="my-field" value="<?php echo esc_attr($fetched_field); ?>" /></td> </tr> <?php } add_action( 'show_user_profile', 'show_my_fields' ); //show in my profile.php page add_action( 'edit_user_profile', 'show_my_fields' ); //show in my profile.php page //add_action( 'user_new_form_tag', 'show_my_fields' ); //to add the fields before the user-new.php form add_action( 'user_new_form', 'show_my_fields' ); //to add the fields after the user-new.php form /** * Saving my form fields */ function save_my_form_fields( $user_id ) { update_user_meta( $user_id, 'my_field', $_POST['my_field'] ); } add_action( 'personal_options_update', 'save_my_form_fields' ); //for profile page update add_action( 'edit_user_profile_update', 'save_my_form_fields' ); //for profile page update add_action( 'user_register', 'save_my_form_fields' ); //for user-new.php page new user addition
can anybody help me?
Viewing 11 replies - 1 through 11 (of 11 total)
Viewing 11 replies - 1 through 11 (of 11 total)
- The topic ‘How can I create a field in the WordPress registration form?’ is closed to new replies.