删除所有Wordpress仪表板小部件3.0+

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了删除所有Wordpress仪表板小部件3.0+相关的知识,希望对你有一定的参考价值。

For those of use who use Wordpress as a CMS, this gives you the option of hiding all your dashboard widgets, for all users.
**Open your theme’s functions.php file located in your theme’s folder. Copy this script, paste it at the bottom of your theme’s function.php file and save it. Go to the dashboard page and everything is gone.
  1. function remove_dashboard_widgets() {
  2. global $wp_meta_boxes;
  3. // For right now information widget
  4. unset($wp_meta_boxes['dashboard']['normal']['core']['dashboard_right_now']);
  5. // For recent comments listing widget
  6. unset($wp_meta_boxes['dashboard']['normal']['core']['dashboard_recent_comments']);
  7. // For quick press widget
  8. unset($wp_meta_boxes['dashboard']['side']['core']['dashboard_quick_press']);
  9. // For recent drafts widget
  10. unset($wp_meta_boxes['dashboard']['side']['core']['dashboard_recent_drafts']);
  11. // For Plugin information widget
  12. unset($wp_meta_boxes['dashboard']['normal']['core']['dashboard_plugins']);
  13. // For incoming links information widget
  14. unset($wp_meta_boxes['dashboard']['normal']['core']['dashboard_incoming_links']);
  15. // For WordPress blog news widget
  16. unset($wp_meta_boxes['dashboard']['side']['core']['dashboard_primary']);
  17. // For other WordPress news widget
  18. unset($wp_meta_boxes['dashboard']['side']['core']['dashboard_secondary']);
  19. }
  20. add_action('wp_dashboard_setup', 'remove_dashboard_widgets' );

以上是关于删除所有Wordpress仪表板小部件3.0+的主要内容,如果未能解决你的问题,请参考以下文章

PHP 如何以编程方式删除WordPress仪表板小部件

从仪表板删除默认小部件(WordPress)

如何以编程方式删除WordPress仪表板小部件

php 在管理仪表板页面上删除不必要的WordPress小部件

从WP-Geo-WordPress插件中删除CSSJS和/或仪表板小部件

PHP 将小部件添加到wordpress管理仪表板