Wordpress - Remove Personal Options section from Profile
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 :)
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' );
Accepted answer is not working with 4.8
Here comes an up to date and simplified code that should work with any version:
// removes admin color scheme options
remove_action( 'admin_color_scheme_picker', 'admin_color_scheme_picker' );
//Removes the leftover 'Visual Editor', 'Keyboard Shortcuts' and 'Toolbar' options.
add_action( 'admin_head', function () {
ob_start( function( $subject ) {
$subject = preg_replace( '#<h[0-9]>'.__("Personal Options").'</h[0-9]>.+?/table>#s', '', $subject, 1 );
return $subject;
});
});
add_action( 'admin_footer', function(){
ob_end_flush();
});