在functions.php 使用以下代碼可以隱藏不必要的欄位資訊
//刪除用戶資料-外掛額外添加資訊的欄位
add_filter('user_contactmethods', function() {
return array();
}, 999);
//移除為用戶更改主題顏色的功能
remove_action( 'admin_color_scheme_picker', 'admin_color_scheme_picker' );
//隱藏yoast 編輯個人資料的欄位
function remove_yoast_Author_setting() {
echo '
<style type="text/css">
div.yoast.yoast-settings { display: none !important; }<br /> </style>
';
}
add_action('admin_head', 'remove_yoast_Author_setting');
//隱藏-編輯個人資料的部分欄位,順序如下
//1.視覺化編輯器 2.鍵盤快速鍵 3.工具列 4.姓氏 5.個人網站網址
//6.個人資料圖片 7.語法醒目提示 8.Wordfence Login Security 9.2FA Status 10.密碼重設郵件
//11.應用程式密碼(ps.要先將wordfence的禁用打開才能隱藏)
function remove_Author_setting() {
echo '
<style type="text/css">
tr.user-rich-editing-wrap { display: none !important; }
tr.user-comment-shortcuts-wrap { display: none !important; }
tr.show-admin-bar.user-admin-bar-front-wrap { display: none !important; }
tr.user-last-name-wrap { display: none !important; }
tr.user-url-wrap { display: none !important; }
tr.user-profile-picture { display: none !important; }
tr.user-syntax-highlighting-wrap { display: none !important; }
h2#wfls-user-settings { display: none !important; }
tr#wordfence-ls { display: none !important; }
tr.user-generate-reset-link-wrap.hide-if-no-js { display: none !important; }
div.application-passwords.hide-if-no-js { display: none !important; }
</style>
';
}
add_action('admin_head', 'remove_Author_setting');