I have disabled wordpress adminbar by adding this filter:

add_filter('show_admin_bar', '__return_false');

But I still want to use it's greeting in other place. By greeting I mean a dropdown menu which says: Howdy admin.

Is there any easy way to do this?

  • Use a conditional? – JMB Jan 8 '14 at 0:46
  • conditional? where and why? I don't want to be using adminbar, only greeting portion – CBeTJlu4ok Jan 8 '14 at 0:48
  • Ah ok, I understand. Top left bit? You could target it with CSS? – JMB Jan 8 '14 at 0:49
  • I know )) and some javascript. but whould be havy to call whole adminbar just because of that. That's why I prefer some PHP solution – CBeTJlu4ok Jan 8 '14 at 0:50
  • 1
    Fair play. I'll think about it. – JMB Jan 8 '14 at 0:53

If I got you right, then you don't want to show other details than the greetings in the front end admina bar. If that is so then you can use Remove Node to make this work.

You can use it like below for only greetings and other options in it to display

First remove the below line

add_filter('show_admin_bar', '__return_false');

Use the below in your active theme's functions.php file.

add_action( 'admin_bar_menu', 'wpse_remove_node', 999 );
function wpse_remove_node( $wp_admin_bar ) {
    $wp_admin_bar->remove_node( 'wp-logo' );
    $wp_admin_bar->remove_node( 'site-name' );
    $wp_admin_bar->remove_node( 'updates' );
    $wp_admin_bar->remove_node( 'comments' );
    $wp_admin_bar->remove_node( 'new-content' );
    $wp_admin_bar->remove_node( 'edit' );

The above will remove all the basic nodes from the admin bar from the front end and even if you have other nodes added due to plugins/theme, then you remove those using the same way.

  • I have searched other solutoins but this seem like the only way (didn't find this) thanks – CBeTJlu4ok Jan 11 '14 at 8:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.