How to Hide or Disable WordPress Admin Dashboard User Profile Page Fields Without Plugins

How to Hide or Disable WordPress Admin Dashboard User Profile Page Fields Without Plugins

Do you want to know how to hide or disable WordPress admin dashboard user profile page fields without plugins?

Is your goal to:

  • Clean up the WP User Profile page
  • Remove fields from the WP User Profile page
  • Disable fields from the WP User Profile page
  • Hide fields from the WP User Profile page
  • Not use a plugin

WP User Fields Aren't Necessary

Perhaps your website or application doesn't need all the user fields and you would like to remove some from the screen.

By default, WordPress user profile page shows quite a few fields – there is first name, last name, nickname, display name, website, and biographical information fields. And, sometimes plugins will add even more fields to the page for external links and social profiles (like Yoast). Most of the fields on the user profile page are optional, but too many unneeded or unused fields can quickly confuse people.

No Plugins Necessary

Good news – you can remove and disable unwanted fields from the WP User Profile admin page without using a plugin.

Some Fields are Required

Bad news – some fields cannot be completely programmatically removed.

Certain fields are required and need to be submitted with the form. These fields cannot be removed from the page because when they are not present it can cause errors with submitting the profile update form or with other functions that require at least a blank value for the field keys, but using WP's built-in jQuery functionality you can at least hide them from the user.

Removing WP User Profile Fields

To the best of my Googling – the theme color picker is the only field that can be removed using a WP hook.

The rest of the fields require tapping in to jQuery and using JavaScript to hide and remove the desired HTML elements from the DOM.

The Code

Without further adieu, the following code snippet can be pasted into your theme's (or child theme's) functions.php file.

/*
*
* 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
				$( '#your-profile .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
	}
	
}

This function checks that you're in the admin area, gets rid of the theme color picker, removes optional fields, and visually hides required fields. Using jQuery element selectors, you can pick and choose which fields to show and hide.