Custom User Contact Methods – WordPress Snippet Generator

Use this tool to generate the code for creation of custom user contact methods to better represent your users.

  • General
  • Method #1
  • #2
  • #3
  • #4
  • #5
  • #6
  • Code



Method #1


Method #2


Method #3


Method #4


Method #5


Method #6


Copy Code

Your customized theme support code snippet is below. Be sure to fully read the instructions that follow before adding this code to your WordPress theme.

Register User Contact Methods

Add this code to your functions.php file. Scroll down to learn more.

// Add User Contact Methods
function {{themeSlug || 'your_theme_slug'}}_user_contact_methods( ${{themeSlug || 'your_theme_slug'}}_user_contact ) {

	${{themeSlug || 'your_theme_slug'}}_user_contact['{{method1key}}'] = __( '{{method1desc}}', '{{textDomain || 'your-text-domain'}}' );
	${{themeSlug || 'your_theme_slug'}}_user_contact['{{method2key}}'] = __( '{{method2desc}}', '{{textDomain || 'your-text-domain'}}' );
	${{themeSlug || 'your_theme_slug'}}_user_contact['{{method3key}}'] = __( '{{method3desc}}', '{{textDomain || 'your-text-domain'}}' );
	${{themeSlug || 'your_theme_slug'}}_user_contact['{{method4key}}'] = __( '{{method4desc}}', '{{textDomain || 'your-text-domain'}}' );
	${{themeSlug || 'your_theme_slug'}}_user_contact['{{method5key}}'] = __( '{{method5desc}}', '{{textDomain || 'your-text-domain'}}' );
	${{themeSlug || 'your_theme_slug'}}_user_contact['{{method6key}}'] = __( '{{method6desc}}', '{{textDomain || 'your-text-domain'}}' );

	return ${{themeSlug || 'your_theme_slug'}}_user_contact;

add_filter( 'user_contactmethods', '{{themeSlug || 'your_theme_slug'}}_user_contact_methods' );


WordPress offers some pretty neat administrative features right out of the box. One such bit of functionality is the user contact information block. This section is located in users profile and allows them to set a number of pre-defined user contact fields.

Defining custom user contact fields in WordPress allows your site’s visitors to connect with other users and team members on more platforms. However, there are no built-in options to add custom user contact fields in the back-end. With this in mind, we’ve put together this custom user contact methods tool to help savvy WordPress developers create a friendlier back-end for clients.

But before we introduce this code snippet generator tool and explain how you can use it, let’s take a closer look at what user contact methods in WordPress are.

What Are User Contact Methods in WordPress?

If you’ve ever added or edited a user in the WordPress back-end, then you’re probably already familiar with the contact fields that are available by default. Typically, these fields will be Email and Website.

Default user contact methods

With a little coding, you can customize the contact information fields that are available to your site’s users. For instance, if you’d rather have your users add their Twitter handles or links to their Google+ pages then you can add custom user contact methods for Twitter and Google+. This makes it easier for your site’s viewership to connect with users on social networks of your choosing.

How Do I Use This Custom User Contact Methods Snippet Generator Tool?

We’ve designed this code snippet generator tool to help both WordPress developers and first-time theme builders add custom user contact methods to their theme’s back-end. This tool allows you to add up to six more custom user contact fields at a time. All you have to do is enter the required fields and the tool will output a custom code snippet for you.

Let’s take a look at the individual fields one by one:

  • General Tab

    • Theme Slug: Enter your theme’s slug into this text field in all lowercase letters, numbers and/or underscores. This value will be used to prefix functions and variables that would otherwise be incompatible with the WordPress core or any installed themes or plugins. Typically, this is the same string as the text domain, with underscores in place of hyphens.
    • Text Domain: The text domain works as a unique key that will be used to identify any translatable strings in your theme or plugin. It should be the same as your theme’s name in lowercase with spaces replaced by hyphens – in other words, it should match the theme’s directory name in the root folder.
  • Method #N Tab

    • Method #N Key: Enter the user contact method’s key. It should be a unique identifier that points to the contact method’s array containing the method description. This field accepts a string ID in all lowercase letters and hyphens (no spaces).
    • Method #N Description: Enter a custom, descriptive summary for the custom user contact method in this field such as custom-description, Twitter handle.
  • Code Tab

    • Once you’ve enabled all of the options you’d like, navigate to the Code tab. You’ll find that the Register User Contact Methods text area is populated with a custom code snippet for adding custom user contact methods to your WordPress site.

How Do I Add the Code Snippet to My Website?

One way to add the generated code snippet to your site is by pasting it directly into your current theme’s functions.php file. To do this, head over to Appearance > Editor from the admin panel, open the functions.php file, and paste the code directly into it. The function should not be called before the init action.

Alternatively, you can download the theme’s functions.php file to your desktop via an FTP client. Next, open it up in a text editor, and paste the code at the bottom of the file. Once you’re done, click the Save button and re-upload it to your theme’s directory. The custom user contact methods will then be available for use.


We designed this tool to make it easier for WordPress developers to add customized user contact information fields into their WordPress themes. Hopefully, this code snippet generator tool will save you some time and effort from having to write code by hand. We encourage you to give it a try in your next theme development project.

Do you have any questions about this Custom User Contact Methods code generator tool? Which custom user contact methods did you create with this tool? Let us know in the comments section below!

Written exclusively for

Nimbus Themes Publishing Logo

About the Author

Evan Scoboria is the co-founder, and developer at Shea Media LLC, the team behind Nimbus Themes, this magazine, and a bunch of very happy clients. He co-founded Shea Media with his wife Kendall in 2009. Evan enjoys hunting, fishing, code, cycling, and most of all WordPress!

Read all posts

Leave a Reply

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