Skip to content

Instantly share code, notes, and snippets.

@mannieschumpert
Last active February 22, 2018 21:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mannieschumpert/6105148 to your computer and use it in GitHub Desktop.
Save mannieschumpert/6105148 to your computer and use it in GitHub Desktop.
Remove unneeded User settings fields in WordPress
<?php
// Hook into the admin footer
add_action( 'admin_footer-user-edit.php', 'remove_user_fields' );
// Print jQuery that removes unneeded elements
function remove_user_fields(){
?>
<script type="text/javascript">
jQuery(document).ready( function($) {
var ids = ['#rich_editing', // Rich editing button
'#admin_color_classic', // Admin color scheme
'#comment_shortcuts', // Keyboard shortcuts for comment moderation
'#aim', // AOL instant messenger
'#yim', // Yahoo messenger
'#jabber', // Jabber
'#description']; // User bio
for (var i = 0; i < ids.length; i++) {
$(ids[i]).closest('tr').remove();
}
});
</script>
<?php
}
@jsalwen
Copy link

jsalwen commented Feb 22, 2018

in wordpress 4.9, the following is needed:

add_action( 'admin_footer', 'remove_user_fields' );

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment