10
09/2014
wordpress admin panel customize
Remove the WordPress Logo from the Toolbar 删除左上角logo(关于)
add_action( 'admin_bar_menu', 'remove_wp_logo', 999 ); function remove_wp_logo( $wp_admin_bar ) { $wp_admin_bar->remove_node( 'wp-logo' ); }
正上方 admin-bar 部分
<?php $wp_admin_bar->remove_node( $id ); ?>
或者(二者等价)
<?php $wp_admin_bar->remove_menu( $id ); ?>
via remove node
Remove WordPress Dashboard Welcome Panel 删除欢迎
//Remove WordPress Welcome Panel remove_action('welcome_panel', 'wp_welcome_panel');
修改版权(左下方)
// customize admin footer text function custom_admin_footer() { echo '2014 © by guoshuang'; } add_filter('admin_footer_text', 'custom_admin_footer');
删除左侧菜单项目
有时候,外观(主题)、插件之类不想让用户修改,要去掉。
//删除菜单项目 function remove_menus(){ remove_menu_page( 'index.php' ); //Dashboard // remove_menu_page( 'edit.php' ); //Posts // remove_menu_page( 'upload.php' ); //Media // remove_menu_page( 'edit.php?post_type=page' ); //Pages remove_menu_page( 'edit-comments.php' ); //Comments // remove_menu_page( 'themes.php' ); //Appearance // remove_menu_page( 'plugins.php' ); //Plugins // remove_menu_page( 'users.php' ); //Users // remove_menu_page( 'tools.php' ); //Tools // remove_menu_page( 'options-general.php' ); //Settings } add_action( 'admin_menu', 'remove_menus' );
admin 后台主题
用户可能接受不了黑色,在 /wp-admin/about.php 这里可以切换颜色
dashboard 控制
//dashboard 部分控制 function example_remove_dashboard_widgets() { global $wp_meta_boxes; unset($wp_meta_boxes['dashboard']['side']['core']['dashboard_quick_press']); 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']['normal']['core']['dashboard_plugins']); unset($wp_meta_boxes['dashboard']['normal']['core']['dashboard_recent_drafts']); unset($wp_meta_boxes['dashboard']['normal']['core']['dashboard_recent_comments']); unset($wp_meta_boxes['dashboard']['side']['core']['dashboard_primary']);//这是wp新闻 unset($wp_meta_boxes['dashboard']['side']['core']['dashboard_secondary']); } add_action('wp_dashboard_setup', 'example_remove_dashboard_widgets' );
还可以判断用户,然后给出不同的 后台!