PHP wordpress隐藏管理面板
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了PHP wordpress隐藏管理面板相关的知识,希望对你有一定的参考价值。
// disable default dashboard widgets
function remove_dashboard_widgets() {
global $wp_meta_boxes;
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_quick_press']);
unset($wp_meta_boxes['dashboard']['side']['core']['dashboard_recent_drafts']);
unset($wp_meta_boxes['dashboard']['side']['core']['dashboard_primary']);
unset($wp_meta_boxes['dashboard']['side']['core']['dashboard_secondary']);
}
add_action('wp_dashboard_setup', 'remove_dashboard_widgets');
// disable default dashboard widgets
function disable_default_dashboard_widgets() {
remove_meta_box('dashboard_right_now', 'dashboard', 'core');
remove_meta_box('dashboard_recent_comments', 'dashboard', 'core');
remove_meta_box('dashboard_incoming_links', 'dashboard', 'core');
remove_meta_box('dashboard_plugins', 'dashboard', 'core');
remove_meta_box('dashboard_quick_press', 'dashboard', 'core');
remove_meta_box('dashboard_recent_drafts', 'dashboard', 'core');
remove_meta_box('dashboard_primary', 'dashboard', 'core');
remove_meta_box('dashboard_secondary', 'dashboard', 'core');
}
add_action('admin_menu', 'disable_default_dashboard_widgets');
// admin see everything
if (!current_user_can('manage_options')) {
add_action('wp_dashboard_setup', 'disable_default_dashboard_widgets');
}
以上是关于PHP wordpress隐藏管理面板的主要内容,如果未能解决你的问题,请参考以下文章
更新 PHP 后,仅在 Wordpress 管理面板上出现太多重定向错误 [关闭]
PHP 在WordPress管理面板中更改页脚文本
php 禁用WordPress管理面板中的主题和插件编辑器
php 隐藏元 - WordPress管理员
php 隐藏菜单链接 - WordPress管理员
php 隐藏管理栏wordpress