WordPress 代码段:禁用仪表板首页的小工具块

对于纯 SEO 或者如果你是为客户管理网站,并希望隐藏后台首页仪表板中的欢迎面板,可以使用下面的代码段来实现。

remove_action( 'welcome_panel', 'wp_welcome_panel' );

还可以隐藏其他的小工具

function remove_dashboard_widgets() {
  global $wp_meta_boxes;
  unset($wp_meta_boxes['dashboard']['normal']['core']['dashboard_plugins']);
  unset($wp_meta_boxes['dashboard']['normal']['core']['dashboard_recent_comments']);
  unset($wp_meta_boxes['dashboard']['normal']['core']['dashboard_incoming_links']);
  unset($wp_meta_boxes['dashboard']['normal']['core']['dashboard_right_now']);
  unset($wp_meta_boxes['dashboard']['side']['core']['dashboard_primary']);
  unset($wp_meta_boxes['dashboard']['side']['core']['dashboard_secondary']);
  unset($wp_meta_boxes['dashboard']['side']['core']['dashboard_quick_press']);
  unset($wp_meta_boxes['dashboard']['side']['core']['dashboard_recent_drafts']);
}
add_action('wp_dashboard_setup', 'remove_dashboard_widgets' );
文章没看懂?代码不会用?需要帮助您可以去论坛提问自助服务台

作者小新

大象、大象 ,你的鼻子怎么那么长 ,妈妈说鼻子长才是漂亮 ......