Ask your WordPress questions! Pay money and get answers fast! Comodo Trusted Site Seal
Official PayPal Seal

Need code to remove unwanted items in user profile section WordPress

  • SOLVED

I need to remove all profile items for users of a specific role, or if easier, for everyone other than admin on my site.

The fields I want to keep:

Username / First and Last Name / Email / Password

Everything else I want rid of including admin color schemes, etc.

I'm hoping this is easy with some code in functions.php. If not, let me know. Willing to pay more if needed.

Thanks!

Answers (1)

2015-07-10

Kyle answers:

Wordpress doesn't make this as easy as you'd hope. Some you can remove together. Others require their own custom tidbits, even jquery scripts. Start with this and let me know what else you need removed:

function remove_contactmethods( $contactmethods ) {
unset($contactmethods['aim']);
unset($contactmethods['yim']);
unset($contactmethods['jabber']);
return $contactmethods;
}
add_filter('user_contactmethods','remove_contactmethods',10,1);

remove_action( 'admin_color_scheme_picker', 'admin_color_scheme_picker' );


Those go in functions.php


Kyle comments:

Remove 'website' field:

function remove_website_row() {

echo "<script>jQuery(document).ready(function(){jQuery('#url').parents('tr').remove();});</script>";

}
add_action('admin_head-user-edit.php','remove_website_row');


Kyler Boudreau comments:

Sweet.

The above code worked great. Thanks.

What's left:

Google Plus
Website (it's still there)
Biography


Kyle comments:

Try this instead of the other website one for all three

function remove_website_row() {

echo "<script>
jQuery(document).ready(function($){
$('tr.user-googleplus-wrap').remove();
$('tr.user-url-wrap').remove();
$('tr.user-description-wrap').remove();
});</script>";

}

add_action('admin_head-user-edit.php','remove_website_row');


Kyler Boudreau comments:

Kyle, I'm voting you the prize. This last one still didn't do it, so if you have another idea let me know. Thanks for the other code that worked well!