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.

I want to hide/remove the Personal Options in the Your Profile (wp-admin/profile.php) admin page.

I am aware that solutions for this exist, but I they use jQuery to do hide this section. This works, but when a user has JavaScript disabled in their browser, it will show up again. Therefore it is not a proper way to remove Personal Options.

Is there a way to remove the Personal Options section from the HTML source of the page? This means no jQuery or CSS hacks, or core file modification.

share|improve this question
add comment

3 Answers 3

up vote 13 down vote accepted

This should do the trick

// removes the `profile.php` admin color scheme options
remove_action( 'admin_color_scheme_picker', 'admin_color_scheme_picker' );

if ( ! function_exists( 'cor_remove_personal_options' ) ) {
  /**
   * Removes the leftover 'Visual Editor', 'Keyboard Shortcuts' and 'Toolbar' options.
   */
  function cor_remove_personal_options( $subject ) {
    $subject = preg_replace( '#<h3>Personal Options</h3>.+?/table>#s', '', $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' );

Also, don't forget to mark your previous questions as solved :)

share|improve this answer
    
wow...this is great!! Thanks –  dev-jim Apr 21 '12 at 9:20
    
this is awesome, but how do i make it work for WP 3.4? only the color scheme picker is removed. probably bec i can't seem to find the files admin_head-profile.php and admin_footer-profile.php in the core. ideas? thanks much. –  Ana Ban Jun 26 '12 at 11:20
    
Are you sure it doesn't work? I just used this on a new installation and it worked OK. Note you have to edit above code if you're using some other language. Also, here's some info about admin_head-profile.php and admin_footer-profile.php: codex.wordpress.org/Plugin_API/… –  Cor van Noorloos Jun 26 '12 at 18:46
add comment

Was just trying to figure this out and came across this answer. The above code by Cor van doesn't work anymore, but with a slight change of the add_action, it can.

All you need to do is change the last two lines from:

add_action( 'admin_head-profile.php', 'cor_profile_subject_start' );
add_action( 'admin_footer-profile.php', 'cor_profile_subject_end' );

to

add_action( 'admin_head-user-edit.php', 'cor_profile_subject_start' );
add_action( 'admin_footer-user-edit.php', 'cor_profile_subject_end' );

So, the final code would look something like:

if ( ! function_exists( 'cor_remove_personal_options' ) ) {
  /**
   * Removes the leftover 'Visual Editor', 'Keyboard Shortcuts' and 'Toolbar' options.
   */
  function cor_remove_personal_options( $subject ) {
    $subject = preg_replace( '#<h3>Personal Options</h3>.+?/table>#s', '', $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-user-edit.php', 'cor_profile_subject_start' );
add_action( 'admin_footer-user-edit.php', 'cor_profile_subject_end' );
share|improve this answer
    
Nice follow up, this change to the original code worked perfectly. –  Daniel Feb 13 at 2:31
add comment

Update for 3.9, the following works:

add_action( 'admin_head', 'cor_profile_subject_start' );
add_action( 'admin_footer', 'cor_profile_subject_end' );
share|improve this answer
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.