Skip to content
Smart Web Worker

Smart Web Worker

  • WordPress
    • WordPress Themes
    • WordPress Snippets
    • WordPress Tips
  • Web Design
  • Web Development
  • Fonts
  • General
  • Contact
WordPress: Add or remove contact methods to user profiles

WordPress: Add or remove contact methods to user profiles

by Smart Web WorkerPosted onFebruary 15, 2012December 19, 2016

The contact methods available in WordPress user profile page needs a major overhaul. Yahoo, AIM and Jabber are no longer the preferred social messaging services. You can remove some contact methods from WordPress user profile data and include more popular messaging services and social media profiles.

Using the “user_contactmethods” filter, you can add (set) and remove (unset) the contact information fields on the user profile page. You just need to add a few lines of code in the functions.php file of the theme.

Here is how you can remove the unused contact methods from the profile page and add Facebook and Twitter.

function my_user_contactmethods($user_contactmethods){

      unset($user_contactmethods['yim']);
      unset($user_contactmethods['aim']);
      unset($user_contactmethods['jabber']);

      $user_contactmethods['twitter'] = 'Twitter Username';
      $user_contactmethods['facebook'] = 'Facebook Username';

      return $user_contactmethods;
    }

To retrieve the new contact methods/social media profile links of users, you can use “get_user_meta” function.

Use the code to display the Twitter handle of WordPress user with ID as 1.

<?php echo get_user_meta(1, 'twitter', true); ?>

If you want to display Facebook username of the author of a blog post, use the following code in the theme’s single.php file.

<?php the_author_meta('facebook'); ?>
Posted in WordPress, WordPress Snippets, WordPress TipsTagged WordPress user profile

Post navigation

Prev WordPress: Delete unused shortcodes in blog posts
Next WordPress: Delete post revisions to speed up your blog

Search the site…

Recent Posts

  • How to Change WordPress URL in MySQL Database Using phpMyAdmin?
  • 10 Tips to Improve Your Website Performance
  • How much to charge for WordPress maintenance?
  • How to Insert Maps in Website?
  • Best Free Handwriting Fonts

Categories

  • Fonts
  • General
  • Web Design
  • Web Development
  • WordPress
  • WordPress Snippets
  • WordPress Themes
  • WordPress Tips

Smart Web Worker

Smart Web Worker is your resource center for web design and development. We share articles and tutorials for web designers and developers. You will also find web design resources such as WordPress themes, fonts and images.

Quick Links

  • Home
  • About
  • Terms of Use
  • Affiliate Disclaimer
  • Contact
  • Sitemap
2025 © Smart Web Worker ⋅ Web Design Resources & Tutorials