cloudtuts

隱藏WordPress後台「個人資料」預設欄位

Jun 18th, 2021 (edited)
566
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.34 KB | None | 0 0
  1. // 隱藏WordPress後台「個人資料」預設欄位
  2. // 出處:https://www.yogoeasy.com/hide-profile-fields/
  3. add_action( 'admin_head', function () { ?>
  4. <script>
  5.     jQuery(document).ready(function(){
  6.         jQuery('#rich_editing').parents('tr').remove(); //視覺化編輯器
  7.         jQuery('#syntax_highlighting').parents('tr').remove(); //語法醒目提示
  8.         jQuery('#comment_shortcuts').parents('tr').remove(); //鍵盤快速鍵
  9.         jQuery('#url').parents('tr').remove(); //網址
  10.         jQuery('#last_name').parents('tr').remove(); //姓氏
  11.         jQuery('#locale').parents('tr').remove(); //選擇語言
  12.         jQuery('#role').parents('tr').remove(); //角色
  13.     });
  14. </script>
  15. <?php
  16. //隱藏聯絡資訊區的欄位
  17. function edit_contactmethods( $contactmethods ) {
  18.   unset($contactmethods['yim']);
  19.   unset($contactmethods['aim']);
  20.   unset($contactmethods['jabber']);
  21. return $contactmethods;
  22. }
  23. add_filter('user_contactmethods','edit_contactmethods',10,1);  
  24.  
  25. //管理後台色彩配置
  26. remove_action("admin_color_scheme_picker", "admin_color_scheme_picker");
  27.  
  28. //新建立使用者時取消勾選寄信
  29. add_action( 'user_new_form', 'dontchecknotify_register_form' );
  30. function dontchecknotify_register_form() {
  31.     echo '<scr'.'ipt>jQuery(document).ready(function($) {
  32.        $("#send_user_notification").removeAttr("checked");
  33.    } ); </scr'.'ipt>';
  34. }
  35. } );
Add Comment
Please, Sign In to add comment