BuddyBoss Home – Web › Support Forums › Themes › BuddyBoss theme › Remove "New" button from Admin Bar
- This topic has 9 replies, 3 contibutors, and was last updated 10 years, 2 months ago by Robert.
Question
August 31, 2014 at 6:06 pm #31129@stranieroHow do I remove the admin button that contains the options to post a new post or media?
Answers
August 31, 2014 at 7:55 pm #31140@alyssa-buddyboss
AlyssaParticipant@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' ); }
August 31, 2014 at 7:59 pm #31141@stranieroThat removes the new post option in the menu, but how would I remove the whole button altogether? (or just hide it)
🙂
September 1, 2014 at 1:08 pm #31160@
AnonymousI used this:
$wp_admin_bar->remove_menu('new-content');
September 2, 2014 at 2:51 pm #31195@alyssa-buddyboss
AlyssaParticipant@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;}
September 2, 2014 at 6:36 pm #31216@stranieroThat 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. 🙂
September 2, 2014 at 6:44 pm #31217@stranieroOut 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.
September 3, 2014 at 3:37 am #31220@
AnonymousI 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' );
September 3, 2014 at 6:18 pm #31236@alyssa-buddyboss
AlyssaParticipant@straniero Here is the full WordPress reference http://codex.wordpress.org/Class_Reference/WP_Admin_Bar/add_node
September 3, 2014 at 6:57 pm #31239@stranieroThanks guys. Will play around with this.
- The question ‘Remove "New" button from Admin Bar’ is closed to new replies.