Created
July 26, 2011 13:04
-
-
Save danielbachhuber/1106704 to your computer and use it in GitHub Desktop.
WordPress admin improvements
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Random set of improvements | |
*/ | |
/** | |
* Tidy up the admin and remove options we don't need | |
*/ | |
function db_clean_up_admin() { | |
// Remove the unneccessary plugins menus | |
remove_submenu_page( 'plugins.php', 'plugin-install.php' ); | |
remove_submenu_page( 'plugins.php', 'plugin-editor.php' ); | |
// Remove unnecessary theme menus | |
remove_submenu_page( 'themes.php', 'theme-editor.php' ); | |
} | |
add_action( 'admin_init', 'db_clean_up_admin' ); | |
/** | |
* Add and remove links from the admin bar | |
*/ | |
function db_admin_bar_modifications() { | |
if ( is_admin_bar_showing() ) { | |
global $wp_admin_bar; | |
// Add a "Edit CSS" link to the appearance dropdown if user can edit | |
if ( current_user_can( 'manage_options' ) ) { | |
$args = array( | |
'title' => 'Edit CSS', | |
'href' => admin_url( 'themes.php?page=editcss' ), | |
'parent' => 'appearance', | |
); | |
$wp_admin_bar->add_menu( $args ); | |
} | |
// Remove the "Add Plugins" and "Add Themes" options | |
$wp_admin_bar->remove_menu( 'new-plugin' ); | |
$wp_admin_bar->remove_menu( 'new-theme' ); | |
} | |
} | |
add_action( 'admin_bar_menu', 'db_admin_bar_modifications', 150 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment