Skip to content

Instantly share code, notes, and snippets.

@jjmontalban
Last active February 3, 2023 09:53
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 jjmontalban/c26c2b95d430ac452203ccc3136c533f to your computer and use it in GitHub Desktop.
Save jjmontalban/c26c2b95d430ac452203ccc3136c533f to your computer and use it in GitHub Desktop.
Remove Color Picker and other unwanted user profile fields from the admin dashboard
<?php
/* Remove Color Picker and other unwanted user profile fields from the admin dashboard */
if ( !is_admin() ) {
// Remove the theme color picker
remove_action("admin_color_scheme_picker", "admin_color_scheme_picker");
// Remove and hide the rest of the User Profile fields (WP Admin Page)
add_action( 'personal_options', 'remove_wp_user_personal_options' );
function remove_wp_user_personal_options() {
?>
<script type="text/javascript">
jQuery( document ).ready(function( $ ){
// Remove Optional Fields
$( '#application-passwords-section, #your-profile .user-profile-picture, .form-table:first, #your-profile h3:first, #your-profile .user-nickname-wrap, #your-profile .user-url-wrap, #your-profile .user-display-name-wrap, h2:contains("About Yourself"), .user-description-wrap' ).remove();
// Hide Required Fields
$( '#your-profile .user-nickname-wrap, #your-profile .user-display-name-wrap' ).hide();
} );
</script>
<?php
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment