Title: Adding custom fields to profile
Last modified: November 14, 2023

---

# Adding custom fields to profile

 *  Resolved [norbertk](https://wordpress.org/support/users/norbertk/)
 * (@norbertk)
 * [2 years, 6 months ago](https://wordpress.org/support/topic/adding-custom-fields-to-profile/)
 * I have created a custom field, named mobile_number, with the following configuration:
 * ![](https://i0.wp.com/i.imgur.com/E0xhUwn.png?ssl=1)
 * This field is under the Default Registration and Default Profile forms. On the
   registration form, it appears correctly:
 * ![](https://i0.wp.com/i.imgur.com/CT7cEhw.png?ssl=1)
 * However, when I try to add it to the user’s account form, it loses the placeholder,
   help text and icon.
 *     ```wp-block-code
       add_action( 'um_after_account_general', 'um_custom_lph_fields', 100 );
   
       function um_custom_lph_fields() {
       	$id = um_user('ID');
   
       	$output = '<div class="um-field">';
   
       	// Array of meta-keys
       	$names = array( 'mobile_number' );
   
       	$fields = array();
   
       	foreach( $names as $name ) {
       		$fields[ $name ] = UM()->builtin()->get_specific_field( $name );
       	}
   
       	$fields = apply_filters( 'um_account_secure_fields', $fields, $id );
   
       	foreach( $fields as $key => $data ) {
       		$output .= UM()->fields()->edit_field( $key, $data );
       	}
   
       	$output .= '</div>';
   
       	echo $output;
       }
       ```
   
 * ![](https://i0.wp.com/i.imgur.com/PUBdHB1.png?ssl=1)

Viewing 6 replies - 1 through 6 (of 6 total)

 *  Plugin Support [andrewshu](https://wordpress.org/support/users/andrewshu/)
 * (@andrewshu)
 * [2 years, 6 months ago](https://wordpress.org/support/topic/adding-custom-fields-to-profile/#post-17203591)
 * Hello [@norbertk](https://wordpress.org/support/users/norbertk/)
 * You could add this code:
 *     ```wp-block-code
       function my_form_edit_mobile_number( $output, $mode ) {
       	if ( 'account' === $mode ) {
       		$additionalCode = '<span class="um-tip um-tip-e" title="YOUR TEXT">
       				<i class="um-icon-help-circled"></i>
       			</span>
       			<div class="um-clear"></div>';
       		$position   = strpos( $output, '</label>' );
   
       		if ( $position !== false ) {
       			$output = substr_replace( $output, $additionalCode, $position + strlen( '</label>' ), 0 );
       		}
       		$output = str_replace( 'placeholder=""', 'placeholder="YOUR PLACEHOLDER"', $output );
       	}
       	return $output;
       }
       add_filter( 'um_mobile_number_form_edit_field', 'my_form_edit_mobile_number', 10, 2 );
       ```
   
 * Regards.
 *  Thread Starter [norbertk](https://wordpress.org/support/users/norbertk/)
 * (@norbertk)
 * [2 years, 6 months ago](https://wordpress.org/support/topic/adding-custom-fields-to-profile/#post-17203725)
 * Thanks for that. Will I have to do this for every custom field that I add to 
   the account page? There’s no way to fetch the actual field data instead of hard
   coding the tool-tips or placeholders?
 *  Plugin Support [andrewshu](https://wordpress.org/support/users/andrewshu/)
 * (@andrewshu)
 * [2 years, 6 months ago](https://wordpress.org/support/topic/adding-custom-fields-to-profile/#post-17206007)
 * Hello [@norbertk](https://wordpress.org/support/users/norbertk/)
 * You need to add this code for each field and change name of hook:
 *     ```wp-block-code
       add_filter( 'um_YOUR-FIELD-KEY_form_edit_field', 'my_form_edit_mobile_number', 10, 2 );
       ```
   
 * Regards.
 *  Thread Starter [norbertk](https://wordpress.org/support/users/norbertk/)
 * (@norbertk)
 * [2 years, 6 months ago](https://wordpress.org/support/topic/adding-custom-fields-to-profile/#post-17207425)
 * [@andrewshu](https://wordpress.org/support/users/andrewshu/) Is there a way to
   get the icon to display (not the help one)?
 *  Plugin Support [andrewshu](https://wordpress.org/support/users/andrewshu/)
 * (@andrewshu)
 * [2 years, 6 months ago](https://wordpress.org/support/topic/adding-custom-fields-to-profile/#post-17214769)
 * Hello [@norbertk](https://wordpress.org/support/users/norbertk/)
 * Where do you wand to add the icon?
 * Regards.
 *  Plugin Support [andrewshu](https://wordpress.org/support/users/andrewshu/)
 * (@andrewshu)
 * [2 years, 6 months ago](https://wordpress.org/support/topic/adding-custom-fields-to-profile/#post-17231819)
 * Hi [@norbertk](https://wordpress.org/support/users/norbertk/)
 * This thread has been inactive for a while so we’re going to go ahead and mark
   it Resolved.
 * Please feel free to re-open this thread if any other questions come up and we’d
   be happy to help. 🙂
 * Regards

Viewing 6 replies - 1 through 6 (of 6 total)

The topic ‘Adding custom fields to profile’ is closed to new replies.

 * ![](https://ps.w.org/ultimate-member/assets/icon-256x256.png?rev=3160947)
 * [Ultimate Member – User Profile, Registration, Login, Member Directory, Content Restriction & Membership Plugin](https://wordpress.org/plugins/ultimate-member/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/ultimate-member/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/ultimate-member/)
 * [Active Topics](https://wordpress.org/support/plugin/ultimate-member/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/ultimate-member/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/ultimate-member/reviews/)

 * 6 replies
 * 2 participants
 * Last reply from: [andrewshu](https://wordpress.org/support/users/andrewshu/)
 * Last activity: [2 years, 6 months ago](https://wordpress.org/support/topic/adding-custom-fields-to-profile/#post-17231819)
 * Status: resolved