删除WordPress仪表盘

quality,Q 70

1638704627 20211205114347 61aca5f3e3143

1638704627 20211205114347 61aca5f3eb902

如果想删除WordPress仪表盘,可以将下面的代码添加到您的当前主题的 functions.php 文件:

  1. function disable_dashboard_widgets() {
  2.     global $wp_meta_boxes;
  3.     // wp..
  4.     unset($wp_meta_boxes[‘dashboard’][‘normal’][‘core’][‘dashboard_activity’]);
  5.     unset($wp_meta_boxes[‘dashboard’][‘normal’][‘core’][‘dashboard_right_now’]);
  6.     unset($wp_meta_boxes[‘dashboard’][‘normal’][‘core’][‘dashboard_recent_comments’]);
  7.     unset($wp_meta_boxes[‘dashboard’][‘normal’][‘core’][‘dashboard_incoming_links’]);
  8.     unset($wp_meta_boxes[‘dashboard’][‘normal’][‘core’][‘dashboard_plugins’]);
  9.     unset($wp_meta_boxes[‘dashboard’][‘side’][‘core’][‘dashboard_primary’]);
  10.     unset($wp_meta_boxes[‘dashboard’][‘side’][‘core’][‘dashboard_secondary’]);
  11.     unset($wp_meta_boxes[‘dashboard’][‘side’][‘core’][‘dashboard_quick_press’]);
  12.     unset($wp_meta_boxes[‘dashboard’][‘side’][‘core’][‘dashboard_recent_drafts’]);
  13. }
  14. add_action(‘wp_dashboard_setup’, ‘disable_dashboard_widgets’, 999);

类似文章