Need to declutter the profile options by removing the various IM fields. It’s easy
add_filter('user_contactmethods', 'remove_im_options', 10, 2); function remove_im_options( $user_contactmethods, $user ) { unset($user_contactmethods['aim']); unset($user_contactmethods['yim']); unset($user_contactmethods['jabber']); //$user_contactmethods = array(); return $user_contactmethods; }
Greetings: I have been looking for an easy way to remove fields from user contact methods, and finally found your site and code … great! Question: How can I also remove the website field located right below the email address? This way, all fields except the email address will be removed, which is what I want. Please advise. I thank you in advance, and look forward to hearing from you at your earliest convenience. Regards, Steve
Unfortunately, the website field isn’t as easy to remove. But in modern browsers, you can target and hide the field with some CSS.
<?php
add_action(‘admin_enqueue_scripts’, ‘hide_website_field’);
function hide_website_field( $hook ) {
$allow = array( ‘profile.php’, ‘user-edit.php’ );
if ( ! in_array( $hook, $allow ) ) return;
?>
<style type=”text/css”>
table.form-table:nth-child(10) tr:nth-child(2) {
display: none;
}
</style>
<?php
}