How to hide Personal Options in WordPress’ User Profile

Even though WordPress might not the friendliest CMS for user management, provides a good amount of customization for users meta information and profiles. However, one thing that is a bit rough right now is the Personal Options block in the User Pofile: you can’t hide it by removing an action hook or even filter it. In this tutorial we’re going to learn how to removing it using jQuery.
You would assume that WordPress would have a hook to remove an action that generated the user profile and its different sections,  but that’s it not the case. A filter? no. A specific class at least? don’t count on it. There’s a hook to dismiss the Color Scheme module but that’s it. For the other stuff we’re going to use jQuery. Open your theme’s functions.php file and add the following

if ( is_admin() ) {
remove_action("admin_color_scheme_picker", "admin_color_scheme_picker");
add_action( 'personal_options', 'ozh_personal_options');
}

The first action we’re adding will prevent WordPress from outputting the Color Scheme section. We could have just let it be displayed since we’re going to strip it out anyway with, but let’s better save a couple of nanoseconds. In any case, if you only want to hide the Color Scheme block this action and its corresponding function is all you need. So long Color Scheme! this is what you should have by now:

The second action will add a bit of JavaScript to the section. This trick is borrowed from Ozh, who wrote a post about adding options to the Personal Options section using this hook. Now we need the function to be executed.

function ozh_personal_options() {
?>
<script type="text/javascript">
jQuery(document).ready(function(){
jQuery("#your-profile .form-table:first, #your-profile h3:first").remove();
});
</script>
<?php
}

And that’s it, your Personal Options section is now gone!

This might come handy for membership sites where your users are not going to post anything and will seldom be in the back end. Why offer them a bunch of confusing options? Let’s keep it simple and remove those options that are useless for your subscribers.

Hopefully, using the first selector in jQuery won’t be neccesary for too long, since there’s a ticket in WordPress Trac scheduled for WP 3.1 to add specific classes to user profile. Now if we could only have core support for taxonomies for users…

7 thoughts on “How to hide Personal Options in WordPress’ User Profile”

  1. very nice post i need some more code for my site
    by inserting that code i need this thing that admin or other user will not able to change their password
    i other word you can say that i want to remove ”new password ;; and info section to avoide chaging password thanks in advance.

  2. Nawaz, just add the following line to the jQuery function:

    jQuery("#password").remove();

    and the password block in WordPress user profile will be removed.

  3. Thanks for this tip! However I tried to add the following code to remove display name but couldn’t figure out how to hide the label as well. Any help?

    jQuery(“#display_name”).remove();

  4. As this thread has helped me out a lot in the past, I just wanted to share the php-isch solution:
    remove_action( 'admin_color_scheme_picker', 'admin_color_scheme_picker' );

    add_filter( 'user_can_richedit', '__return_false' );

    add_filter( 'show_admin_bar', '__return_false' );

    if ( ! function_exists( 'cor_remove_personal_options' ) ) {
    function cor_remove_personal_options( $subject ) {
    $pattern = '#Personal Options.+?/table>#s';
    $subject = preg_replace( $pattern, '', $subject, 1 );
    return $subject;
    }

    function cor_profile_subject_start() {
    ob_start( 'cor_remove_personal_options' );
    }

    function cor_profile_subject_end() {
    ob_end_flush();
    }
    }
    add_action( 'admin_head-profile.php', 'cor_profile_subject_start' );
    add_action( 'admin_footer-profile.php', 'cor_profile_subject_end' );

Leave a Reply