skip to Main Content
Menu

WP Admin Bar

Ever wanted to give someone access to your site’s posting features but didn’t want them to have full access to your wordpress admin? here’s a nifty piece of code that you can place in your theme’s function.php file..


if (current_user_can('administrator'))
{
}else{
function custom_admin_bar() {
global $wp_admin_bar;
if ( !current_user_can( 'install_themes' ) ) {
$wp_admin_bar->remove_node( 'wp-logo' );
// or individually remove its children
$wp_admin_bar->remove_node( 'about' );
$wp_admin_bar->remove_node( 'wporg' );
$wp_admin_bar->remove_node( 'documentation' );
$wp_admin_bar->remove_node( 'support-forums' );
$wp_admin_bar->remove_node( 'feedback' );
//$wp_admin_bar->remove_node( 'site-name' );
$wp_admin_bar->remove_node( 'comments' );
//$wp_admin_bar->remove_node( 'new-content' );
// or individually remove its children
// $wp_admin_bar->remove_node( 'new-post' );
// $wp_admin_bar->remove_node( 'new-media' );
$wp_admin_bar->remove_node( 'new-link' );
$wp_admin_bar->remove_node( 'new-page' );
}
}
add_action('wp_before_admin_bar_render', 'custom_admin_bar');
}

The code simply checks if you are the admin (when you are logged in). The function custom_admin_bar() only works for those who are below the admin level. This works in conjuction with the adminimize plugin. This makes up for what the plug-in lacks..

Source : http://wordpress.org/support/topic/hiding-admin-bar-in-wordpress-33/page/2

Update: addtional Source : http://www.doitwithwp.com/customize-wordpress-admin-bar/#custom

Alphonse

Editorial Staff at ETN Multimedia is led by Alphonse Tan. Page maintained by Alphonse Tan

Back To Top