在我們的WordPress后臺是不是可以看到很多儀表盤的菜單。實(shí)際上大部分的菜單儀表盤的信息是無用的。如果我們比較講究極簡風(fēng)格,我們還是可以直接移除這些功能的。
//刪除儀表盤模塊 function example_remove_dashboard_widgets() { // Globalize the metaboxes array, this holds all the widgets for wp-admin global $wp_meta_boxes; // 以下這一行代碼將刪除 "快速發(fā)布" 模塊 unset($wp_meta_boxes['dashboard']['side']['core']['dashboard_quick_press']); // 以下這一行代碼將刪除 "引入鏈接" 模塊 unset($wp_meta_boxes['dashboard']['normal']['core']['dashboard_incoming_links']); // 以下這一行代碼將刪除 "插件" 模塊 unset($wp_meta_boxes['dashboard']['normal']['core']['dashboard_plugins']); // 以下這一行代碼將刪除 "近期評論" 模塊 unset($wp_meta_boxes['dashboard']['normal']['core']['dashboard_recent_comments']); // 以下這一行代碼將刪除 "近期草稿" 模塊 unset($wp_meta_boxes['dashboard']['side']['core']['dashboard_recent_drafts']); // 以下這一行代碼將刪除 "WordPress 開發(fā)日志" 模塊 unset($wp_meta_boxes['dashboard']['side']['core']['dashboard_primary']); // 以下這一行代碼將刪除 "其它 WordPress 新聞" 模塊 unset($wp_meta_boxes['dashboard']['side']['core']['dashboard_secondary']); // 以下這一行代碼將刪除 "概況" 模塊 unset($wp_meta_boxes['dashboard']['normal']['core']['dashboard_right_now']); } add_action('wp_dashboard_setup', 'example_remove_dashboard_widgets' ); remove_action('welcome_panel', 'wp_welcome_panel'); function remove_dashboard_meta() { remove_meta_box( 'dashboard_activity', 'dashboard', 'normal');//3.8版開始 } add_action( 'admin_init', 'remove_dashboard_meta' ); //wordpress刪除儀表盤站點(diǎn)健康模塊 function remove_dashboard_siteHealth() { remove_meta_box( 'dashboard_site_health', 'dashboard', 'normal' ); } add_action('wp_dashboard_setup', 'remove_dashboard_siteHealth' );
這里,我們可以移除近期評論、開發(fā)日志、概況,甚至健康模塊。這樣還可以加速我們后臺的訪問速度。
評論