Upon the release of WordPress 2.9, we shared with you an article that shows you how to add fields like twitter and facebook to author profile page. In this article we will show you how you can remove unwanted default author profile fields to make WordPress admin panel more user friendly for your clients.
As you can see, we do not want to keep AIM, Yahoo IM, and Jabber/Gtalk. If you are dealing with very new level clients, then you do not want them to see this. It will only complicate things for them. To remove these default fields simply open your theme’s functions.php file and add the following code:
<?php add_filter('user_contactmethods','hide_profile_fields',10,1); function hide_profile_fields( $contactmethods ) { unset($contactmethods['aim']); unset($contactmethods['jabber']); unset($contactmethods['yim']); return $contactmethods; } ?>
This will remove the contact methods like AIM, Jabber, and Yahoo IM. Now if you want to add fields then you should check out our article that talks about adding author profile fields in WordPress.
Source: Strangework by Brad Williams
this is how my fields look
function extra_contact_info($contactmethods)
{
unset($contactmethods[‘aim’]); unset($contactmethods[‘yim’]); unset($contactmethods[‘jabber’]); unset($contactmethods[‘website’]); $contactmethods[‘facebook’] = ‘Facebook’;
$contactmethods[‘twitter’] = ‘Twitter’;
$contactmethods[‘linkedin’] = ‘LinkedIn’;
$contactmethods[‘google_profile’] = ‘Google Profile URL’;
$contactmethods[‘Adsense’] = ‘Adsense’;
$contactmethods[‘Adsense250’] = ‘Google_ad_slot250*250 Code’; $contactmethods[‘Adsense300’] = ‘Google_ad_slot300*250’;
return $contactmethods;
}
add_filter(‘user_contactmethods’, ‘extra_contact_info’);
I used to get them with this code in my post
<?php the_author_meta( ‘twitter’ ); ?>
<?php the_author_meta( ‘facebook’ ); ?>
it works perfect but when i get this in my adsence code there is no ads coming
<?php the_author_meta( ‘Adsense’ ); ?>
<script type=”text/javascript”>
<!– google_ad_client = “<?php the_author_meta( ‘Adsense’ ); ?>”;
/* 250×250,created 8/15/11 */
google_ad_slot = “1738948625”;
google_ad_width = 250;
google_ad_height = 250;
//–> </script>
<script type=”text/javascript” src=”http://pagead2.googlesyndication.com/pagead/show_ads.js”>
</script>
can u please help me on this
how to remove the website
That code raises in WP 3.2.1 following warnings. It removes those 3 entries though:
Warning: call_user_func_array() [function.call-user-func-array]: First argument is expected to be a valid callback, ‘hide_profile_fields’ was given in /wp/wp-includes/plugin.php on line 170 Warning: Invalid argument supplied for foreach() in /wp/wp-admin/includes/user.php on line 230
I fixed it now. It had nothing to do with this code. I just put the “add_filter”-method into the __construct method and forgot to make the function public.
Other fix could have been (see “array(&$this”…:
add_action(‘user_contactmethods’, array(&$this,’my_function’));
@OneWorld
This is yet another example of the valuable information available at WP Beginner. Thanks guys.
This is great. I’ve already implemented it on two sites. Thanks so much!
aah excellent post, thanks a lot
I think wp should remove these by themself,
why aim,jabber lol they should add facebook and twitter
Thanks for this one guys. We restrict all of this so this is a perfect tool to ensure we don’t have to see it either.
This is yet another example of the valuable information available at WP Beginner. Thanks guys.