Remove the “+New” Dropdown Menu When Logged In

Remove the new dropdown menu when logged in image

When you’re logged in to the WordPress admin, there’s that pesky “+New” dropdown in the menu bar across the top. If you don’t want it, just remove it!

What it does…

Removes the “+New” dropdown menu from the Top Admin Menu Bar when logged in.

Why it does it…

Sometimes you just don’t want it!

How it does it…

Uses the `remove_menu` method on `$wp_admin_bar`

Download JSON for importing into Code Snippets Pro
Download PHP for adding as a plugin or copying into functions.php

See the code…

<?php

// Admin Menu: Remove the +New Dropdown Menu When Logged In
// https://snipsnip.pro/s/299
// For removing items other than the "New" menu, see here: https://snipsnip.pro/s/249
namespace Gw7RGsk;

function remove_newmenu_from_top_admin_menu() {
    // if you only want to remove it for certain users/roles you could do something
    // lik: get_current_user then check: if (in_array('editor',$user->roles)) {}
    global $wp_admin_bar;
	// remove the entire +New menu
    $wp_admin_bar->remove_menu('new-content');
}
\add_action( 'wp_before_admin_bar_render', '\Gw7RGsk\remove_newmenu_from_top_admin_menu' );