使用@Matth\\u eu的答案,您可以启用/禁用实际的管理栏,但要在用户编辑中隐藏该选项。php和配置文件。php屏幕,使用以下选项:
//Removes the \'Show Toolbar\' option.
function as_remove_personal_options( $subject ) {
$subject = preg_replace( \'#<tr class="show-admin-bar">.+?/tr>#s\', \'\', $subject, 1 );
return $subject;
}
function as_profile_subject_start() {
ob_start( \'as_remove_personal_options\' );
}
function as_profile_subject_end() {
ob_end_flush();
}
add_action( \'admin_head-profile.php\', \'as_profile_subject_start\' );
add_action( \'admin_footer-profile.php\', \'as_profile_subject_end\' );
add_action( \'admin_head-user-edit.php\', \'as_profile_subject_start\' );
add_action( \'admin_footer-user-edit.php\', \'as_profile_subject_end\' );