Removing WordPress profile fields from non-admins

If you do not want your users to be confused with information that they don’t have to input therefore it might be a good idea to remove them. And I mean removing them since hiding is not an option and it involves CSS or JS solution that makes those fields and titles disappear after the page has loaded and it means that the user gets to see some flickering in the fields.

How to remove WordPress admin Profile page fields (Including Personal Options, Biographical Info, Website etc.) and titles without JS. Simply copy and paste it in your functions.php file:

    <?php
    // Remove fields from Admin profile page
    if ( ! function_exists( 'cor_remove_personal_options' ) ) {
        function cor_remove_personal_options( $subject ) {

            $subject = preg_replace('#<tr class="user-display-name-wrap(.*?)</tr>#s', '', $subject, 1); // Remove the "Display name publicly as" field
            return $subject;
        }

        function cor_profile_subject_start() {
            if ( ! current_user_can('manage_options') ) {
                ob_start( 'cor_remove_personal_options' );
            }
        }

        function cor_profile_subject_end() {
            if ( ! current_user_can('manage_options') ) {
                ob_end_flush();
            }
        }
    }
    add_action( 'admin_head', 'cor_profile_subject_start' );
    add_action( 'admin_footer', 'cor_profile_subject_end' );

So this does the trick and removes fields from admin Profile page.

But if you do not want to remove the nickname field like this since it is mandatory. So for this you can use the solution with JS like so:

    <?php 

    //Remove fields from Admin profile page via JS to hide nickname field which is mandatory
    function remove_personal_options(){
        if ( ! current_user_can('manage_options') ) { // 'update_core' may be more appropriate
            echo '<script type="text/javascript">jQuery(document).ready(function($) {
                $(\'form#your-profile tr.user-nickname-wrap\').hide(); // Hide the "nickname" field
            });</script>';
        }
    }
    add_action('admin_head','remove_personal_options');

And the only thing that could be removed via hook was Admin color scheme and it is done like so:

// Removes ability to change Theme color for the users
remove_action( 'admin_color_scheme_picker', 'admin_color_scheme_picker' );

No need to hide the fields using Javascript, just use the above code and throw out the lines you do not wan’t to be removed.

Thanks!