Created
June 14, 2015 07:58
-
-
Save rianrietveld/68ca39635ecde8541c7e to your computer and use it in GitHub Desktop.
Remove items from the WordPress admin bar
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 | |
add_action( 'admin_bar_menu', 'prefix_remove_stuf_admin_bar', 999 ); | |
function prefix_remove_stuf_admin_bar( $wp_admin_bar ) { | |
$wp_admin_bar->remove_node( 'wp-logo' ); | |
$wp_admin_bar->remove_node( 'comments' ); | |
$wp_admin_bar->remove_node( 'wpseo-menu' ); | |
if ( !current_user_can( 'edit_others_pages' ) ) { | |
$wp_admin_bar->remove_node( 'new-content' ); | |
} | |
return $wp_admin_bar; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment