Last active
February 3, 2023 09:53
-
-
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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