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

Posted

tags:

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

  1. // Create the function to use in the action hook
  2. function example_remove_dashboard_widgets() {
  3. // Globalize the metaboxes array, this holds all the widgets for wp-admin
  4.  
  5. global $wp_meta_boxes;
  6.  
  7. // Remove the incomming links widget
  8. unset($wp_meta_boxes['dashboard']['normal']['core']['dashboard_incoming_links']);
  9.  
  10. // Remove right now
  11. unset($wp_meta_boxes['dashboard']['normal']['core']['dashboard_right_now']);
  12. unset($wp_meta_boxes['dashboard']['side']['core']['dashboard_primary']);
  13. unset($wp_meta_boxes['dashboard']['side']['core']['dashboard_secondary']);
  14. }
  15.  
  16. // Hoook into the 'wp_dashboard_setup' action to register our function
  17. add_action('wp_dashboard_setup', 'example_remove_dashboard_widgets' );

以上是关于从仪表板删除默认小部件(WordPress)的主要内容,如果未能解决你的问题,请参考以下文章

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

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

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

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

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

自定义 wordpress 小部件的设置未显示