Last active
August 29, 2015 14:06
-
-
Save steppohub/745fc81fa85bc6fee3a0 to your computer and use it in GitHub Desktop.
Hide Admin Bar stuff
This file contains 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
// remove help thingo | |
add_filter( 'contextual_help', 'wpse50723_remove_help', 999, 3 ); | |
function wpse50723_remove_help($old_help, $screen_id, $screen){ | |
$screen->remove_help_tabs(); | |
return $old_help; | |
} | |
// remove other admin stuff | |
function wps_admin_bar() { | |
global $wp_admin_bar; | |
$wp_admin_bar->remove_menu('wp-logo'); | |
$wp_admin_bar->remove_menu('about'); | |
$wp_admin_bar->remove_menu('comments'); // Remove the comments link | |
$wp_admin_bar->remove_menu('wporg'); | |
$wp_admin_bar->remove_menu('documentation'); | |
$wp_admin_bar->remove_menu('support-forums'); | |
$wp_admin_bar->remove_menu('feedback'); | |
} | |
add_action( 'wp_before_admin_bar_render', 'wps_admin_bar' ); | |
function OXP_admin_bar_edit() { | |
global $wp_admin_bar; | |
$wp_admin_bar->remove_menu('new-content'); // This removes the complete menu “Add New”. You will not require the below “remove_menu” if you using this line. | |
$wp_admin_bar->remove_menu('new-post'); // This (when used individually with other “remove menu” lines removed) will hide the menu item “Post”. | |
$wp_admin_bar->remove_menu('new-page'); // This (when used individually with other “remove menu” lines removed) will hide the menu item “Page”. | |
$wp_admin_bar->remove_menu('new-media'); // This (when used individually with other “remove menu” lines removed) will hide the menu item “Media”. | |
$wp_admin_bar->remove_menu('new-link'); // This (when used individually with other “remove menu” lines removed) will hide the menu item “Link”. | |
$wp_admin_bar->remove_menu('new-user'); // This (when used individually with other “remove menu” lines removed) will hide the menu item “User”. | |
$wp_admin_bar->remove_menu('new-theme'); // This (when used individually with other “remove menu” lines removed) will hide the menu item “Theme”. | |
$wp_admin_bar->remove_menu('new-plugin'); // This (when used individually with other “remove menu” lines removed) will hide the menu item “Plugin”. | |
} | |
if ( !current_user_can('edit_users') ) {add_action( 'wp_before_admin_bar_render', 'OXP_admin_bar_edit' );} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment