|
/ Documentation /Custom Code Snippets/ How to Add Custom Fields to the User Profile in SureDash

How to Add Custom Fields to the User Profile in SureDash

In SureDash, each user has a profile that displays standard information like their name and email. But what if you want to collect extra details like a phone number, job title, or company name?

You can easily do this by using a filter to add custom fields to the user profile.

This guide walks you through how to add a custom field (like “Phone”) to the SureDash user profile section.

Steps to Add a Custom Field to the User Profile

We’ll use a simple filter that inserts a new field into the profile form. This can be used to collect any additional data from your users.

1. Copy the Filter Code

Here’s a sample code to add a Phone field:

add_filter( 'suredash_user_profile_fields', 'suredash_add_custom_profile_fields' );

/**
 * Add custom fields to the user profile.
 *
 * @param array $fields Existing profile fields.
 * @return array Updated profile fields.
 */
function suredash_add_custom_profile_fields( $fields ) {
	$meta_key = 'phone';
	$fields[ $meta_key ] = array(
		'label' => __( 'Phone', 'suredash' ),
		'type'  => 'input', // input or textarea.
		'placeholder' => __( 'Enter your phone number', 'suredash' ),
		'value' => get_user_meta( get_current_user_id(), $meta_key, true ),
		'external' => true,
	);

	return $fields;
}

You can duplicate the code block inside the function to add more fields. Just make sure to use a different $meta_key and update the label and placeholder text accordingly.

  • A user profile page before and after adding the custom field
  • The code snippet inside a Code Snippets plugin window

2. Add the Code to Your Site

To safely add this PHP code, use a custom code plugin or your theme’s functions.php file.

We recommend using the Code Snippets plugin to make this easier.

Steps:

  • Go to Plugins > Add New, search for Code Snippets, and install it.
  • Then go to Snippets > Add New
  • Give the snippet a title like Add Phone Field to User Profile
  • Paste the code from above
  • Click Save Changes and Activate
  • Installing the Code Snippets plugin
  • Adding a new snippet with the custom field code
  • Snippet successfully saved and activated

For more details, follow this guide: How to Add Custom PHP Code to Your WordPress Site

3. View the Custom Field on User Profiles

Once the code is active:

  • Go to a user’s profile inside SureDash
  • You’ll see the Phone field appear in the profile section

Users can now enter and save their phone number directly.

  • User profile page with the custom “Phone” field visible

Conclusion

That’s it! You’ve successfully added a custom field to the SureDash user profile. You can follow the same method to collect other useful information like location, website, company, or bio.

Was this doc helpful?
What went wrong?

We don't respond to the article feedback, we use it to improve our support content.

On this page
Scroll to Top