腾讯云服务器优惠活动华纳云香港服务器

如何删除WordPress后台的仪表盘模块?

WordPress主题推荐

如果想删除 WordPress 后台的仪表盘活动、快速草稿、概览和 WordPress 活动及新闻等模块,只需要将下面的代码添加到当前主题的 functions.php 文件中即可:

//删除 WordPress 后台仪表盘
function disable_dashboard_widgets() {
global $wp_meta_boxes;
unset($wp_meta_boxes['dashboard']['normal']['core']['dashboard_activity']);
unset($wp_meta_boxes['dashboard']['normal']['core']['dashboard_right_now']);
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_plugins']);
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', 'disable_dashboard_widgets', 999);

其中以上代码无法删除 Welcome 模块,可以在“显示选项”中不勾选“Welcome”模块即可。

以上内容整理自@知更鸟

如果想要移除仪表盘中的“欢迎”模块,只需要将以下代码添加到当前主题的 functions.php 文件中即可:

//WordPress 彻底移除后台仪表盘欢迎使用
add_action( 'load-index.php', 'remove_welcome_panel' );
function remove_welcome_panel(){
remove_action('welcome_panel', 'wp_welcome_panel');
delete_user_meta( get_current_user_id(), 'show_welcome_panel' );
}

以上内容整理自@泪雪博客

相关阅读

本文地址:https://boke112.com/post/4964.html

赞 (6) 打赏
版权声明:本文为原创文章,版权归 boke112百科 所有,欢迎分享本文,转载请保留出处!发布此文是出于传递更多信息之目的,若有来源标注错误或侵犯了您的合法权益,请联系我们,确认后马上更正或删除,谢谢!
wu