我只是想弄明白,然后找到了这个答案。Cor van的上述代码不再有效,但只要稍微更改add\\u操作,就可以了。
您只需将最后两行更改为:
add_action( \'admin_head-profile.php\', \'cor_profile_subject_start\' );
add_action( \'admin_footer-profile.php\', \'cor_profile_subject_end\' );
至
add_action( \'admin_head-user-edit.php\', \'cor_profile_subject_start\' );
add_action( \'admin_footer-user-edit.php\', \'cor_profile_subject_end\' );
因此,最终的代码如下所示:
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\' );