1

enter image description here

I would like to know how I can remove content inside .ab-sub-wrapper but keep Log Out and Edit My Profile links? Just want to keep thing nice and tidy

1 Answer 1

2

You can use wordpress nodes to customize profile menu.

Add this in functions.php

add_action( 'admin_bar_menu', 'remove_my_account', 999 );
function remove_my_account( $wp_admin_bar ) {
   $wp_admin_bar->remove_node( 'my-account' );
}

add_action( 'admin_bar_menu', 'add_logout', 999 );
function add_logout( $wp_admin_bar ) {
   $args = array(
      'id'     => 'logout',           // id of the existing child node (New > Post)
      'title'  => 'Logout',           // alter the title of existing node
      'parent' => 'top-secondary',    // set parent
  );
  $wp_admin_bar->add_node( $args );
}
1
  • Thank you for the provided code. It is what I am after. Nice and simple exit button. Jul 15, 2018 at 6:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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