Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

Under "Personal Options" on user profile page, there are: (1) disable visual editor (2) admin color scheme (3) keyboard shortcuts (4) show admin bar

I can remove admin color scheme using remove_action, but not the rest.

Is there a way to remove them all at once? Or one by one using remove_action or style or js?

share|improve this question
add comment

2 Answers 2

up vote 2 down vote accepted

I think this is the kind of thing you had in mind.

add_action( 'admin_print_styles-profile.php', 'remove_profile_fields' );
add_action( 'admin_print_styles-user-edit.php', 'remove_profile_fields' );

function remove_profile_fields( $hook ) {
    ?>
    <style type="text/css">
        form#your-profile p+h3,
        form#your-profile p+h3+table { display:none!important;visibility:hidden!important; }
    </style>
    <?php
} 

There aren't any actions or filters to remove the items you're referring to(with exception the admin color scheme), and the table they sit in does not have a unique identifier, which in turn means the only solution to getting rid of them is using CSS or jQuery selectors, neither of which will work for every user.

IE6 for example won't understand the CSS i've written above and will just ignore it.

jQuery solutions are possible, but like the above, they won't work for every user.

@Jeremy,
Whilst it's nice you've shown how to add a stylesheet to the admin, it's not really ideal to suggest adding one to every admin page when the requirement was to only load additional CSS or JS for a specific one or two pages, you should ideally also be using plugins_url() for generating the URL to plugin files.

share|improve this answer
    
@t3los, thanks for the tips. I appreciate the honest comment. –  Jeremy Jared Jul 11 '11 at 3:44
    
Thank you for this intermediary solution, it's good enough for the time being. –  Sean Lee Jul 11 '11 at 8:30
    
You're welcome. :) –  t31os Jul 11 '11 at 9:56
    
@t31os I've seen a core ticket in wordpress trac. I think wordpress 3.4 will have hook to remove them without using css. Check this patch Can you tell me what code i should use to remove it if apply that patch? Thanks –  Giri Dec 30 '11 at 23:57
add comment

This might not be the most elegant solution, but it works. I made a simple plug-in for customizing the WordPress Admin area. Just save this code as custom_admin.php and put it in a folder named custom_admin:

<?php
/*
Plugin Name: Custom Admin
Plugin URI: http://ideatree-website-design.com/
Description: Creating a Better Looking WordPress Admin Screen
Version: 1.0
Author: Jeremy Jared
Author URI: http://ideatree-website-design.com/
*/
add_action( 'admin_print_styles', 'load_custom_admin_css' );

function load_custom_admin_css()
{
wp_enqueue_style('my_style', WP_CONTENT_URL . '/plugins/custom_admin/custom_admin.css');
} 
?>

Next create a style-sheet and name it custom_admin.css and place this code in the file:

.form-table th, label, #your-profile label + a, #postcustomstuff table, #your-profile fieldset, #rightnow, div.dashboard-widget, #dashboard-widgets p.dashboard-widget-links, #replyrow #ed_reply_toolbar input {
display:none !important;
}

Place the custom_admin.php and the custom_admin.css in the custom_admin folder, upload it to your plug-ins folder.

You can then activate it inside the plug-ins section. To make changes just go to plug-ins>edit> and choose the custom_admin plugin to add or remove css. This can also be used to customize the look of the admin area.

share|improve this answer
    
I know this part of the code. I actually need the hook if remove_action, the class or id if css for those items, which I cannot quite pinpoint. Of course, hook is cleaner. –  Sean Lee Jul 8 '11 at 5:41
    
I don't know the hook, but the css i Provided are the ID's and class's for the items. –  Jeremy Jared Jul 8 '11 at 7:05
    
I've checked the ID and classes, they don't match. There is no individual id or classes that can be used to remove the label and the h3 personal options header. –  Sean Lee Jul 10 '11 at 18:18
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.