BuddyBoss Home – Web Support Forums Themes BuddyBoss theme Remove "New" button from Admin Bar

Viewing 10 posts - 1 through 10 (of 10 total)
  • Question

    #31129
    @straniero

    How do I remove the admin button that contains the options to post a new post or media?

    http://screencast.com/t/KHEKBB47L2Go

    Answers

    #31140

    Alyssa
    Participant
    @alyssa-buddyboss

    @straniero this is a WordPress issue but try adding this to your functions.php file in your child theme:

    add_action( 'wp_before_admin_bar_render', 'remove_toolbar_menus' );
    function remove_toolbar_menus() {
        global $wp_admin_bar;
        $wp_admin_bar->remove_menu( 'new-post' );
    }
    #31141
    @straniero

    That removes the new post option in the menu, but how would I remove the whole button altogether? (or just hide it)

    🙂

    #31160

    Anonymous
    @

    I used this: $wp_admin_bar->remove_menu('new-content');

    #31195

    Alyssa
    Participant
    @alyssa-buddyboss

    @straniero Assuming you still want to see this as an admin try this:

    #wp-admin-bar-root-default{display:none;}
    .role-admin#wp-admin-bar-root-default{display:block;}
    #31216
    @straniero

    That didn’t work, so I combined your code with @gansad’s and came up with this which seems to work,

    add_action( 'wp_before_admin_bar_render', 'remove_toolbar_menus' );
    function remove_toolbar_menus() {
        global $wp_admin_bar;
        $wp_admin_bar->remove_menu('new-content');
        $wp_admin_bar->remove_menu('comments');
    } 

    That went in the functions file. 🙂

    #31217
    @straniero

    Out of curiosity…

    is there a way to remove the items from that button, but replace them with other ones?

    Specifically “new forum post” and “new photo upload”

    Could be cool, as users seem very drawn to that button. Would be a shame to waste the real estate.

    #31220

    Anonymous
    @

    I am using this for my admin bar menu

    function mytheme_admin_bar_render() {
    global $wp_admin_bar;
    
    // Remove the New 'Slides' drop-down link submenu
    $wp_admin_bar->remove_menu('new-buddyboss_slides');
    
    // Remove new LINK submenu
    $wp_admin_bar->remove_menu('new-link');
    
    // Remove New Location submenu
    $wp_admin_bar->remove_menu('new-location');
    
    // Remove New Reply submenu
    $wp_admin_bar->remove_menu('new-reply');
    
    // Remove New Ideas submenu
    $wp_admin_bar->remove_menu('new-ideas');
    
    // Here we add New IdeaStream URL link submenu
     $myURL = 'http://domain.com/is/new-idea/';
     $wp_admin_bar->add_menu( array(
     'parent' => 'new-content',
     'id' => 'new-ideastream',
     'title' => 'IdeaStream',
    'href' => $myURL
    ));
      
    // ADD a new top level menu link
    // Here we add a Raising Concern URL link
     $concernURL = 'http://domain.com/concernreporting/';
     $wp_admin_bar->add_menu( array(
     'parent' => false,
     'id' => 'raise_concern',
     'title' => '<i class="fa fa-send-o fa-5x"></i> Report Concern',
    'href' => $concernURL
    ));
    
    // Add a new sub-menu to the link above
    // Here we add a link to our contact us web page
    // $contactUsURL = 'http://domain.com/contact2/';
    // $wp_admin_bar->add_menu(array(
    // 'parent' => 'raise_concern',
    // 'id' => 'contact_us',
    // 'title' =>'Contact Us',
    // 'href' => $contactUsURL
    // ));
    
    }
    
    // Finally we add our hook function
    add_action( 'wp_before_admin_bar_render', 'mytheme_admin_bar_render' );
    
    #31236

    Alyssa
    Participant
    @alyssa-buddyboss
    #31239
    @straniero

    Thanks guys. Will play around with this.

Viewing 10 posts - 1 through 10 (of 10 total)
  • The question ‘Remove "New" button from Admin Bar’ is closed to new replies.