久青草国产观看在线视频,在线观看欧美日女,777毛片,亚洲国产精品99久久久久久久

  • 文章介紹
  • 快速入門
  • 評價&建議

前言:

WordPress 后臺很多模塊有時并不需要,使用下面的代碼可以將它們屏蔽掉。

根據需要,將下面代碼添加到當前主題functions.php模板文件中:

屏蔽左側菜單:

  1. function remove_menus() {  
  2.     global $menu;  
  3.     $restricted = array(  
  4.         __('Dashboard'),  
  5.         __('Posts'),  
  6.         __('Media'),  
  7.         __('Links'),  
  8.         __('Pages'),  
  9.         __('Appearance'),  
  10.         __('Tools'),  
  11.         __('Users'),  
  12.         __('Settings'),  
  13.         __('Comments'),  
  14.         __('Plugins')  
  15.     );  
  16.     end ($menu);  
  17.     while (prev($menu)){  
  18.         $value = explode(' ',$menu[key($menu)][0]);  
  19.         if(strpos($value[0], '<') === FALSE) {  
  20.             if(in_array($value[0] != NULL ? $value[0]:"" , $restricted)){  
  21.                 unset($menu[key($menu)]);  
  22.             }  
  23.         }else {  
  24.         $value2 = explode('<', $value[0]);  
  25.             if(in_array($value2[0] != NULL ? $value2[0]:"" , $restricted)){  
  26.                 unset($menu[key($menu)]);  
  27.             }  
  28.         }  
  29.     }  
  30. }  
  31. if (is_admin()){  
  32.     // 屏蔽左側菜單  
  33.     add_action('admin_menu', 'remove_menus');  
  34. }  

刪除子菜單:

  1. function remove_submenu() {  
  2.     // 刪除”設置”下面的子菜單”隱私”  
  3.     remove_submenu_page('options-general.php', 'options-privacy.php');  
  4.     // 刪除”外觀”下面的子菜單”編輯”  
  5.     remove_submenu_page('themes.php', 'theme-editor.php');  
  6. }  
  7. if (is_admin()){  
  8.     //刪除子菜單  
  9.     add_action('admin_init','remove_submenu');  
  10. }  

屏蔽后臺更新模塊:

  1. function wp_hide_nag() {  
  2.     remove_action( 'admin_notices', 'update_nag', 3 );  
  3. }  
  4. add_action('admin_menu','wp_hide_nag');  

屏蔽 WP 后臺“顯示選項”和“幫助”選項卡:

  1. function remove_screen_options(){ return false;}  
  2.     add_filter('screen_options_show_screen', 'remove_screen_options');  
  3.     add_filter( 'contextual_help', 'wpse50723_remove_help', 999, 3 );  
  4.     function wpse50723_remove_help($old_help$screen_id$screen){  
  5.     $screen->remove_help_tabs();  
  6.     return $old_help;  
  7. }  

屏蔽后臺儀表盤無用模塊:

  1. function example_remove_dashboard_widgets() {  
  2.     // Globalize the metaboxes array, this holds all the widgets for wp-admin  
  3.     global $wp_meta_boxes;  
  4.     // 以下這一行代碼將刪除 "快速發布" 模塊  
  5.     unset($wp_meta_boxes['dashboard']['side']['core']['dashboard_quick_press']);  
  6.     // 以下這一行代碼將刪除 "引入鏈接" 模塊  
  7.     unset($wp_meta_boxes['dashboard']['normal']['core']['dashboard_incoming_links']);  
  8.     // 以下這一行代碼將刪除 "插件" 模塊  
  9.     unset($wp_meta_boxes['dashboard']['normal']['core']['dashboard_plugins']);  
  10.     // 以下這一行代碼將刪除 "近期評論" 模塊  
  11.     unset($wp_meta_boxes['dashboard']['normal']['core']['dashboard_recent_comments']);  
  12.     // 以下這一行代碼將刪除 "近期草稿" 模塊  
  13.     unset($wp_meta_boxes['dashboard']['side']['core']['dashboard_recent_drafts']);  
  14.     // 以下這一行代碼將刪除 "WordPress 開發日志" 模塊  
  15.     unset($wp_meta_boxes['dashboard']['side']['core']['dashboard_primary']);  
  16.     // 以下這一行代碼將刪除 "其它 WordPress 新聞" 模塊  
  17.     unset($wp_meta_boxes['dashboard']['side']['core']['dashboard_secondary']);  
  18.     // 以下這一行代碼將刪除 "概況" 模塊  
  19.     unset($wp_meta_boxes['dashboard']['normal']['core']['dashboard_right_now']);  
  20. }  
  21. add_action('wp_dashboard_setup', 'example_remove_dashboard_widgets' );  

屏蔽后臺頁腳版本信息:

  1. function change_footer_admin () {return '';}  
  2. add_filter('admin_footer_text', 'change_footer_admin', 9999);  
  3. function change_footer_version() {return '';}  
  4. add_filter( 'update_footer', 'change_footer_version', 9999);  

屏蔽后臺左上LOGO:

  1. function annointed_admin_bar_remove() {  
  2.         global $wp_admin_bar;  
  3.         /* Remove their stuff */  
  4.         $wp_admin_bar->remove_menu('wp-logo');  
  5. }  
  6. add_action('wp_before_admin_bar_render', 'annointed_admin_bar_remove', 0);  
0 0

企業建站推薦正版商業主題,國內專業團隊開發,完善售后,是您不二選擇。

正版主題商店

主題貓WP建站,累計幫助1300+客戶成功建站,為站長提供支持!

立刻開啟你的建站之旅
QQ在線客服

服務熱線

wordpress建站咨詢