[Other] Brenda – how to hide Edit Profile in Admin bar

Hi, how can I hide the Edit Profile menu item In the admin bar under the user name (see image) and keep only the logout?

[attachments are only viewable by logged-in members]

 

  • Olivija Guzelyte
    • WP Core Meltdown

    Hi there gols

    Hope you’re well!

    I’ve checked Branda, and unfortunately editing the ‘Howdy, Admin’ menu is not possible with Branda. You can only use it to hide the ‘Howdy, Admin’ menu and i.e. create a custom one from scratch.

    Therefore, I’ve come up with a code snippet that can add/remove links from the ‘Howdy, Admin’ menu dropdown. You should add the snippet to the /wp-content/mu-plugins/ directory as a PHP file. If the /mu-plugins/ directory does not exist, you can create it. See the code below:

    <?php
    
    add_action( 'admin_bar_menu', 'edit_howdy_admin_menu_unique');
    
    function edit_howdy_admin_menu_unique($wp_admin_bar)
    {
      // remove sub-items by ID
      $wp_admin_bar->remove_node('edit-profile'); // remove Edit Profile menu
    }

    To remove existing items, you use a line as such:

    $wp_admin_bar->remove_node(‘edit-profile’);

    which removes the item by its ID. Refer to screenshot below how to find the ID in case you want to remove any other items from that menu:

    [attachments are only viewable by logged-in members]

    Let me know if you need further help/clarification regarding this.

    Kind regards,
    Olivija